1
0
mirror of https://github.com/danog/blackfriday.git synced 2024-11-30 04:29:13 +01:00
Commit Graph

187 Commits

Author SHA1 Message Date
Vytautas Šaltenis
d85484cdc4
Fix comment about inline footnotes (#473) 2018-08-25 00:13:41 +03:00
Vytautas Šaltenis
e97f103314
Use the same .travis.yml on master and v2 (#462)
Use the same .travis.yml on master and v2
2018-08-04 14:45:05 +03:00
Nathan Glenn
3420fef033 Add full info string in fenced code blocks (#449)
* Add full info string in fenced code blocks

According to common mark, the info string for a fenced code block can be any
non-whitespace string, so adjust the code to read a full string instead of
just the syntax name.

Fixes #410 in v2.

* run go fmt
2018-04-28 13:25:38 +03:00
Vytautas Šaltenis
19913a1b76 Address feedback 2017-07-30 19:50:50 +03:00
Vytautas Šaltenis
d5487615af Several small documentation fixes 2017-07-29 11:59:03 +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
Pierre Neidhardt
2501229ba6 Rename Markdown()->Run() and Processor->Markdown 2017-06-05 21:42:05 +01:00
Pierre Neidhardt
a47518da29 [SQUASH] Doc update 2017-06-01 17:43:27 +01:00
Pierre Neidhardt
3cc9341a19 Merge Parser into Processor 2017-05-29 10:52:11 +02:00
Vytautas Šaltenis
a8c45a7349 Merge branch 'v2' into v2-functional-opts 2017-02-14 21:51:06 +02:00
Vytautas Šaltenis
5ebfae50aa Merge pull request #331 from russross/v2-fix-180-again
Fix #180 again
2017-02-14 21:40:27 +02: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
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
5e1065fa45 Fix blooper: remove dead code 2017-02-02 17:24:53 +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
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
120bb2fae1 Get rid of the preprocess stage
Yay!!
2016-11-10 21:49:58 +02:00
Pierre Neidhardt
627dc87cad Add missing type to TableAlignment* constants 2016-10-09 08:43:40 +05:30
Vytautas Šaltenis
6141d5fde1 Merge pull request #306 from russross/v2-add-links-to-footnotes
V2 add links to footnotes
2016-10-03 08:14:53 +03:00
Vytautas Šaltenis
8a11177489 Add direct link to a footnote from it's referer
Some renderers might not care to have an explicit list of footnotes at
the end of the document, instead they're interested in the content of
the footnote at the location of a referer. Make their lives easier by
providing such a link
2016-09-17 19:35:42 +03:00
Pierre Neidhardt
4688db5f6f Remove the LaTeX renderer stub and point to Ambrevar's implementation 2016-09-10 16:17:05 +05:30
Vytautas Šaltenis
b91b5719eb Merge pull request #302 from russross/v2-move-footnotest-to-html
v2: move footnotes to html
2016-09-10 11:32:03 +03:00
Vytautas Šaltenis
91753e8bc7 v2: Extract package level documentation to doc.go (#303)
* Extract package level documentation to doc.go

Plus elaborate the documentation a bit.

* Fix grammar
2016-09-05 10:25:10 +03:00
Vytautas Šaltenis
d36199c417 Rename firstPass -> preprocess 2016-09-03 15:32:37 +03:00
Vytautas Šaltenis
3c2cb1ff45 Fix typo 2016-09-03 15:29:28 +03:00
Vytautas Šaltenis
43ba539936 Add some documentation to reference struct 2016-09-03 13:16:41 +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
Vytautas Šaltenis
ea8dfc4880 Move reference extraction to paragraph parser
Move reference and footnote extraction code from firstPass to a
paragraph block parser. This makes firstPass a little bit slimmer, ergo
closer to elimination.
2016-09-03 11:32:41 +03:00
Vytautas Šaltenis
efa77da18b Fix omission in list item flags
When parseRefsToAST constructs a list of footnotes, it hardcoded the
item flags to ListTypeOrdered and omitted ListItemBeginningOfList.

However, a quick look around indicates that ListItemBeginningOfList
might have lost its meaning altogether in v2 (it used to control item
spacing in v1, which is now extracted from the AST structure). So add a
TODO to clean that up one day.
2016-08-29 00:16:22 +03:00
Vytautas Šaltenis
771cf410c8 Get rid of secondPass function
Most of its body was redundant, as it was moved to parseRefsToAST. After
removal of that code, only a single line remains, so move it out to the
caller of secondPass.
2016-08-29 00:16:22 +03:00
Pierre Neidhardt
6fd47b3b61 v2: Only split when inline callbacks consume some bytes (#301)
* Only split when inline callbacks consume some bytes

The former hacks around maybeLineBreak and Smartypants are no longer
needed.
The algorithm has been streamlined: shorter, simpler, faster.
The 'currBlock' field of the parser is gone.

* Remove spurious logs
2016-08-19 08:56:33 +03:00
Vytautas Šaltenis
9926922c0b Merge pull request #295 from Ambrevar/v2FactorSmarty
v2: Factor Smartypants to HTML
2016-08-10 23:01:58 +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
Pierre Neidhardt
fdbedcdb78 Export tree manipulation functions 2016-08-10 08:59:15 +05:30
Pierre Neidhardt
4d756003cd Move TOC generation to the HTML Renderer 2016-08-09 12:37:44 +05:30
Vytautas Šaltenis
a9baf845f1 Unpublish and rename LinkType constants (#285)
* Unpublish and rename LinkType constants

The constants are only used in the parsing phase, they are not recorded
in the AST directly, so make them private. Improve their names along the
way. Fix tagLength to return two values instead of taking an output
parameter.

* autoLinkType -> autolinkType

And remove unnecessary comment.
2016-07-29 08:01:31 +03:00
Vytautas Šaltenis
46b7355a78 Fix bullet points in MarkdownCommon docs 2016-07-28 19:23:04 +03:00
Vytautas Šaltenis
6d7f5e1bca More lint: block.go 2016-07-27 21:40:45 +03:00
Vytautas Šaltenis
e054c962e7 More lint: markdown.go and ripples to other files 2016-07-27 21:28:41 +03:00
Dmitri Shuralyov
2560c5f148 Fix issue in fenced code block pre-processing.
Forwardport changes from #280.

Fixes #279.
2016-07-15 17:03:02 -04:00
Vytautas Šaltenis
2f1f0b6b9f Add RenderNode to Renderer interface 2016-07-05 07:32:16 +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
c9ea588e6f Convert uint32 fields to ints
The former is a bit too inconvenient despite being more accurate.
2016-04-11 11:15:15 +03:00
Vytautas Šaltenis
98ddf98997 Get rid of unneeded method in Renderer 2016-04-11 11:12:41 +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
Vytautas Šaltenis
123179b8f3 Make Markdown the most general API call
Get rid of MarkdownOptions.
2016-04-05 13:45:00 +03:00
Vytautas Šaltenis
9da90c5929 Allow NodeVisitor to have some control over traversal
Make NodeVisitor return status and decide upon it which node to go to
next. So far, this allows to skip subtrees and quit early.
2016-04-05 12:48:28 +03:00
Vytautas Šaltenis
d7f18785f1 Implement TOC and OmitContents
Move these two flags from HTML renderer's flags to extensions. Implement
both since they were not yet implemented in the AST rewrite. Add tests.

Note: the expected test strings differ very slightly from v1. The HTML
produced by v2 has a few extra newlines compared to the old one, but
it's now uniform with other sections of the generated document. If the
newline placement gets cleaned up in the future, this will get fixed
automatically, since the renderer is agnostic about the TOC list.
2016-04-04 12:04:20 +03:00