1
0
mirror of https://github.com/danog/blackfriday.git synced 2024-11-26 20:14:43 +01:00
Commit Graph

111 Commits

Author SHA1 Message Date
Cameron Moore
646308596a Run tests in parallel (#480)
Fixes #475
2018-09-08 00:47:14 +03:00
Liming Jin
670777b536 add NoopenerLinks (#437) 2018-05-26 10:57:26 +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
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
a8c45a7349 Merge branch 'v2' into v2-functional-opts 2017-02-14 21:51:06 +02:00
Vytautas Šaltenis
7500a7e2ed Fix #180 again
The check was introduced with d28de22, when fixing #172 and #173.
Then I removed it with bcd6dd8 when fixing #180
And then it was reintroduced with 232d06c when fixing regression.

It seems that the check can be removed again. All these cases now have
tests (including the one from 69f51af, which seems to have landed to v1
only, copying it here) and they all pass.
2017-02-12 17:57:51 +02:00
Vytautas Šaltenis
e81d1d1138 Change the public interface to use functional options
Convert the most important Blackfriday's function, Markdown(), to accept
functional options (as per this Dave Cheney's post:
https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis)
2017-02-02 16:57:25 +02:00
Vytautas Šaltenis
d04a53c644 Merge branch 'v2' into v2-perf-tweaks 2017-02-02 12:00: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 Šaltenis
120bb2fae1 Get rid of the preprocess stage
Yay!!
2016-11-10 21:49:58 +02: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
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
2e23e31bd4 Fix typo 2016-08-01 20:52:17 +03:00
Vytautas Šaltenis
83b4cb6062 Implement SkipHTML, add test 2016-04-05 12:48:29 +03:00
Vytautas Šaltenis
7e9a57463f Implement SkipStyle, add test
Fix a bug in findHtmlTagPos introduced with e02c392d.
2016-04-05 12:48:28 +03:00
Vytautas Šaltenis
fecfec2059 Implement SkipImages and add test 2016-04-05 12:48:28 +03:00
Vytautas Šaltenis
6bd31203b1 Add test for UseXHTML 2016-04-05 09:51:46 +03:00
Vytautas Šaltenis
607478a8ce Implement SkipLinks, add test 2016-04-04 14:08:35 +03:00
Vytautas Šaltenis
b069de6276 Wrap inline test parameters in a struct
Take advantage of zero value initialization.
2016-04-04 12:04:20 +03:00
Vytautas Šaltenis
15e052e478 Move all testing helper funcs in one place
Moved verbatim except for uncommented panic recovery section in the
doTestsInlineParam function.
2016-04-04 12:04:20 +03:00
Vytautas Šaltenis
0b69796248 Go style: more Html -> HTML renames 2016-04-01 15:37:21 +03:00
Vytautas Šaltenis
2a07386455 Rename HtmlFlags to HTMLFlags to adhere to Go style 2016-04-01 10:49:23 +03:00
Vytautas Šaltenis
a55b2615a4 Run Smartypants as a separate pass over the AST
Separate Smartypants somewhat from the HTML renderer. Move its flags
from HtmlFlags to Extensions (probably should be moved to its own set of
flags, but not now). With that done, do a separate walk of the tree and
either run Smartypants processor if it's enabled, or simply escape text
nodes.
2016-04-01 10:44:22 +03:00
Vytautas Šaltenis
4d74c6a071 Make common flags and extensions public
Add DefaultOptions convenience variable.
2016-03-30 19:29:00 +03:00
Vytautas Šaltenis
a32ecdb83d Fix footnote tests
This commit does some changes to the test suite. The changes are only to
the newlines. Turns out the former implementation of footnotes produced
slightly different spacing when rendering the footnotes list. The new
implementation produces the list that is compatible with the rest of the
package.
2016-03-30 15:03:11 +03:00
Vytautas Šaltenis
dd01088b7a Remove last call to Truncate() from parser
Autolink detection used to be triggered by a colon and preceding
protocol name used to be rewound. Now instead of doing that, trigger
autolink processing on [hmfHMF] and see if it looks like a link.
2015-11-10 21:36:31 +02:00
Vytautas Šaltenis
ee98bc0bf4 Massive replacement of C_STYLE flags to typed ones 2015-11-10 21:08:32 +02:00
Vytautas Šaltenis
510be64de0 Merge pull request #216 from russross/issue-194
Fix footnote following an exclamation point
2015-11-04 21:40:57 +02:00
Vytautas Šaltenis
ca8c21a297 Fix footnote following an exclamation point
Link parser interpreted the sequence "![^foo]" as an image, but if
footnote extension is enabled, it's quite clear that it should be
interpreted as a footnote following something with an exclamation point
at the end.

Closes #194.
2015-11-03 20:52:36 +02:00
Vytautas Šaltenis
9e68ff937b Fix nested footnotes
This is both nasty and neat at the same time. All the code could handle
nested footnotes just fine, the only place that was not working was the
final loop that printed the list. The loop was in a range form, which
couldn't account for another footnote being inserted while processing
existing ones. Changing the loop to the iterative form solves that.

Closes #193.
2015-11-02 20:17:46 +02:00
Vytautas Šaltenis
4b26653fe0 Fix broken test and add test for HTML_SMARTYPANTS_DASHES 2015-10-27 20:21:08 +02:00
Vytautas Šaltenis
a18a46c9b9 Merge pull request #203 from russross/issue-136
Handle comments within a block
2015-10-20 20:45:00 +03:00
Vytautas Šaltenis
c9f5708bd5 Spread out test cases for readability 2015-10-20 20:31:08 +03:00
Vytautas Šaltenis
53982c119c Merge pull request #206 from russross/issue-164
Fix footnote followed by a reference style link
2015-10-19 09:17:51 +03:00
Vytautas Šaltenis
4b668b875b Merge pull request #205 from russross/issue-156
Fix bug parsing emphasis
2015-10-19 09:08:30 +03:00
Vytautas Šaltenis
f7510976a3 Fix escaping asterisks within emphasis
First check for escaped character, *then* look if i-th character is an
emphasis character.

Closes #18.
2015-10-13 19:57:15 +03:00
Vytautas Šaltenis
08eac30cb9 Fix footnote followed by a reference style link
When parsing a deferred footnote, we already know it's a footnote from
the '[^' part, so we can use that to hit a proper switch branch
(default) a bit later on.

Closes #164.
2015-10-12 21:18:33 +03:00
Vytautas Šaltenis
cc3cc10ef2 Fix bug parsing emphasis
Start searching for emphasis character at 0th index instead of 1st.
Fixes a corner case with doubly emphasised code span followed by
another code span on the same line.

Changes interpretation of improperly nested emphasis, hence the change
in TestEmphasisMix().

Closes #156.
2015-10-12 21:06:27 +03:00
Vytautas Šaltenis
5d3d5c198e Handle comments within a block
Added test cases both for inline and block workflows.

Closes #136.
2015-10-11 11:14:34 +03:00
Dmitri Shuralyov
18186eea26 Do not emit newline after <img> tag.
This changes HTML renderer not to always add a newline character after
<img> tags. This is desirable because <img> tags can be inlined, and
sometimes you want to avoid whitespace on left and right sides. Previous
behavior of always adding a newline would unavoidably create whitespace
after <img> tag.

Update all tests to match new behavior. There are few changes, and
they're completely isolated to inline image tests.

Fixes #169.
2015-05-25 12:59:05 -07:00
Vytautas Šaltenis
314ce8fe44 Add a missing test case for reference override
Exercise link text override.
2015-05-06 15:57:15 +03:00
Vytautas Šaltenis
eeb2c39339 Merge branch 'master' of https://github.com/jtolds/blackfriday into jtolds-master
Conflicts:
	inline_test.go
2015-05-06 15:41:12 +03:00
neclepsio
58c4ddd431 Added test for backslash line break 2015-04-23 10:49:08 +02:00
Vytautas Šaltenis
b3137e7c8f Merge pull request #152 from elian0211/about_links
update about links
2015-04-09 20:41:45 +03:00
Vytautas Šaltenis
195dac9f5b Fix recognition of consecutive footnotes
The second footnote was treated as if the pair of them were a reference
style link, without checking if the second bit is another footnote.

Fixes issue 158.
2015-04-03 21:08:46 +03:00
Beyang Liu
60b0b4024f add rel="noreferrer" option 2015-03-14 16:46:32 -07:00
elian0211
27ba4cebef update about links
when link to current directory or parent directory
2015-02-20 17:06:55 +08:00
Anthony Fok
2c9fe2cd03 Avoid converting dates into fractions
So that dates like 1/2/2005 and 2005/3/4 stay the way it is
without turning into ½/2005 and 2005/¾.

See http://discuss.gohugo.io/t/any-way-to-disable-smart-fractions/328
for discussions.
2015-01-24 15:23:48 -07:00
KenjiTakahashi
fdda8b88b0 add tests for emphasis with links 2014-12-28 06:28:15 +01:00
JT Olds
5e8b222b69 Add programmable reference overrides
If a user provides a ReferenceOverride function, then reference ids
will be passed to the given ReferenceOverride function first, before
consulting the generated reference table.

The goal here is to enable programmable support for
"WikiWords"-style identifiers or other application-specific
user-generated keywords.

Example, writing documentation:

 The [Frobnosticator][] is a very important class in our codebase.
 While it is used to frobnosticate widgets in general, it can also
 be passed to the [WeeDoodler][] to interesting effect.

This might be solveable with the HTML Renderer relative prefix, but
I didn't see a good way of making a short link to 'Frobnosticator'
relatively without having to write it twice. Maybe
'<Frobnosticator>' should work? Should Autolinks work for relative
links?

In addition, I wanted a little more richness. I plan to support
Godoc links by prefixing references with a '!', like so:

  Check out the [Frobnosticator][] helper function
  [!util.Frobnosticate()][]

The first link links to the Frobnosticator architectural overview
documentation, whereas the second links to Godoc.

Better advice on how to implement this sort of think with
Blackfriday is highly desired.
2014-12-16 16:17:52 -07:00