1
0
mirror of https://github.com/danog/blackfriday.git synced 2024-11-26 12:04:46 +01:00
Commit Graph

176 Commits

Author SHA1 Message Date
46f3fff6e1
Switch to chroma 2022-01-06 20:42:55 +01:00
2c98907303 Update namespace 2022-01-06 18:49:55 +01:00
7a9993e054
Final fixes 2022-01-06 18:21:16 +01:00
e99e04f09b
Invoke pygmentize 2022-01-06 17:53:33 +01:00
ba29d94709
Add syntax highlighting 2022-01-06 17:42:05 +01:00
Russ Ross
acedacffef
Merge pull request #468 from ruqqq/v2
Fix html renderer escaping valid entities
2020-07-14 10:41:29 -06:00
Nathan Galt
412ca19665 Use ↩ as default params.FootnoteReturnLinkContents
This changes the default `params.FootnoteReturnLinkContents` from `<sup>[return]</sup>` to `↩\ufe0e`.

It’s very common to use `↩` in footnote links. However, some platforms like iOS and iPadOS choose to use emoji presentation for this particular character. This leads to lots of blogs, by default, looking silly on portable Apple gizmos, as described in <https://github.com/jgm/pandoc/issues/5469>. By switching to a return arrow with a disable-emojification variation selector, we get blackfriday to do the right thing by default.

Additionally, ↩ is more language-agnostic than “return” is, so blackfriday will work better out of the box for more people.
2019-06-10 16:05:36 -07:00
Faruq Rasid
6762cd3685 Only allow valid HTML entities to be unescaped. Do not escape HTML entities in code blocks. 2018-09-06 17:05:43 +08:00
Liming Jin
670777b536 add NoopenerLinks (#437) 2018-05-26 10:57:26 +03:00
Emil Melnikov
f04854434e Add heading offset option to HTML renderer (#421)
Setting HTMLRendererParameters.HeadingLevelOffset to L changes
default HTML heading levels from hX to h(X+L).
2018-05-24 21:52:48 +03:00
Iain Haslam
ee09303c1a v2: Fix HTML5 by removing rel="footnote" which is invalid.
See #433 for an equivalent change on v1 branch.
2018-02-24 18:23:00 +00:00
Vytautas Šaltenis
cadec560ec Merge pull request #384 from bep/v2
Add Smartypants support for French Guillemets
2017-08-06 20:10:14 +03:00
Bjørn Erik Pedersen
3a1d515242 Add Smartypants support for French Guillemets
This is a port of the fix for #378 in v1.

Fixes #380
2017-08-02 21:42:14 +02:00
Vytautas Šaltenis
45820516bb Unexport a bunch of constants private to HTML renderer (#381)
Unexport a bunch of constants private to HTML renderer

They were cluttering the documentation and are not useful otherwise.
Rearrange constants in descending dependencies order
2017-08-02 09:20:10 +03:00
Vytautas Šaltenis
427717f991 Use io.WriteString instead of w.Write([]byte(str)) 2017-07-10 19:11:30 +03:00
Vytautas Šaltenis
479920a987 Improve the Renderer interface
Improve Renderer to be less confusing. Fix documentation for it.

OmitContents flag got dropped along the way. First, it would fit poorly
into the new design and second, it's unclear how widely this feature is
used. But most importantly, it's trivial to roll your own with the v2
API: https://gist.github.com/rtfb/2693f6bfcc1760661e8d2fb832763a15

Fixes #368.
2017-07-09 15:44:00 +03:00
Vytautas Šaltenis
747587a52d Fix all headings wrongly referred to as headers
I've left test cases alone since can't lean on the compiler for
crosschecking there.

Fixes #330.
2017-02-12 19:05:30 +02:00
Vytautas Šaltenis
d04a53c644 Merge branch 'v2' into v2-perf-tweaks 2017-02-02 12:00:48 +02:00
Vytautas Šaltenis
ea57e93666 Several fixes after code review 2017-02-02 11:54:10 +02:00
Vytautas Šaltenis
a4dd8ad4a6 Merge pull request #324 from russross/move-toc-to-html
Move TOC and OmitContents to HTML flags
2016-12-07 21:07:04 +02:00
Vytautas Šaltenis
9c4ef640b9 Move TOC and OmitContents to HTML flags
The root problem this commit fixes is the duplication of Extensions
field in HTMLRendererParameters. The duplication crept in there only to
support these two flags, so moving the flags solves the problem. They're
only used in renderer anyway.

Fixes #277.
2016-11-24 21:48:48 +02:00
Vytautas Šaltenis
b61f73e4f9 Ditch SkipStyle flag
It's been broken since early 2014, which clearly demonstrates that
nobody uses it.

Fixes #252.
2016-11-24 20:37:33 +02:00
Vytautas Saltenis
22a3e5b744 Avoid calling bytes.Split() in appendLanguageAttr
This avoids some allocs.
2016-10-29 12:09:34 +03:00
Vytautas Šaltenis
c60ee1aab0 Avoid allocating []byte for every written newline
This shaves off another ~25% of allocs.
2016-10-08 18:17:00 +03:00
Vytautas Šaltenis
993325d13f Roll our own implementation of HTML escaper 2016-09-10 14:33:37 +03:00
Vytautas Šaltenis
31f2685bfe Remove lots of string literals
Using strings in helper functions causes a lot of string-to-[]byte
allocations. This fix is centered around converging the tag() helper
func to the []byte lingo. In order to do that, a lot of string literals
have moved to global variables, where string to []byte conversion can
happen once.
2016-09-10 13:17:42 +03:00
Vytautas Šaltenis
6947216efb Move footnote rendering to the renderer
Clean up footnotes part of an AST: don't force HTML-specific pieces
there, just keep a clean list of footnotes. Since some renderers might
want to process footnotes differently, let them know about footnotes by
having a flag on that list.
2016-09-03 12:39:16 +03:00
Pierre Neidhardt
225250ddf1 html.go: Lint RenderNode() 2016-08-12 09:16:14 +05:30
Pierre Neidhardt
02da1dfe9d Factor Smartypants to HTML
Smartypants is HTML-specific.
There is no need to run Smartypants from `Render()`.
This simplifies extensions built upon the HTML renderer.
2016-08-10 09:58:33 +05:30
Vytautas Šaltenis
37141d5b5a Merge pull request #296 from Ambrevar/v2icon
v2: Add Icon parameter to the HTML renderer
2016-08-09 22:22:31 +03:00
Pierre Neidhardt
413328d30b Add Icon parameter to the HTML renderer 2016-08-09 17:54:34 +05:30
Pierre Neidhardt
b5ff8e0286 Break lines properly in TOC generation and omit content if required 2016-08-09 15:11:40 +05:30
Pierre Neidhardt
4d756003cd Move TOC generation to the HTML Renderer 2016-08-09 12:37:44 +05:30
Vytautas Šaltenis
e054c962e7 More lint: markdown.go and ripples to other files 2016-07-27 21:28:41 +03:00
Vytautas Šaltenis
f7ec3b0e34 Fix a few lint errors, a.k.a. improve docs 2016-07-27 10:11:13 +03:00
Vytautas Šaltenis
89653c9927 Merge pull request #274 from Ambrevar/v2misc
v2: Implicit interface and Stringer
2016-07-27 09:39:58 +03:00
Vytautas Šaltenis
6291a00f2f Remove dead fields from HTMLRenderer 2016-07-05 07:33:21 +03:00
Vytautas Šaltenis
cb6bd67271 Remove dead HTMLWriter code 2016-07-04 22:02:22 +03:00
Vytautas Šaltenis
f90a576a05 Untangle some mess with attribute escaping
1. Remove unused preserveEntities parameters
2. Move attrEscape() implementation inside esc()
3. Delegate most of esc() work to escCode()
2016-07-02 10:45:06 +03:00
Pierre Neidhardt
20aa621387 Fix empty path to CSS 2016-07-01 18:18:51 +02:00
Pierre Neidhardt
2e53c20b2f Return a *HTMLRenderer from NewHTMLRenderer
Interfaces should be satisfied implicitly.
2016-07-01 17:23:30 +02:00
Vytautas Šaltenis
3575453f08 Move a couple helpers to parser where they're used 2016-04-11 15:55:50 +03:00
Vytautas Šaltenis
76d8c71d70 Unduplicate attrEscape funcs 2016-04-11 15:55:50 +03:00
Vytautas Šaltenis
e95d23065a Rename HTML to HTMLRenderer 2016-04-11 11:45:40 +03:00
Vytautas Šaltenis
c26fdef40e Move html entity regexp to where it's used
And unify regexp variable names.
2016-04-11 11:45:19 +03:00
Vytautas Šaltenis
c207eca993 Clean up Renderer interface: remove all callbacks
We now expose the structure of the document in the form of AST, there's
no longer need to have all those callbacks to represent structure.
2016-04-11 11:22:38 +03:00
Vytautas Šaltenis
98ddf98997 Get rid of unneeded method in Renderer 2016-04-11 11:12:41 +03:00
Vytautas Šaltenis
24e146a727 Make HTMLRendererParameters a substruct of HTML 2016-04-05 14:44:14 +03:00
Vytautas Šaltenis
9f5de868aa Go style: take advantage of zero value init 2016-04-05 14:34:30 +03:00
Vytautas Šaltenis
1303ea1427 Cleanup renderer constructors
Move all parameters under HTMLRendererParameters struct, rename
constructors to New{HTML|Latex}Renderer.
2016-04-05 14:24:27 +03:00