Commit Graph

115 Commits

Author SHA1 Message Date
Krzysztof Kowalczyk da9aa552d2 tweak comments; reduce comment boilerplate 2018-01-26 14:21:26 -08:00
Krzysztof Kowalczyk a13c6ae544 tweak function naming and comments 2018-01-26 14:09:47 -08:00
Krzysztof Kowalczyk 87ee7bc5e5 rename text() => newTextNode 2018-01-26 12:07:52 -08:00
Krzysztof Kowalczyk 6b2a8abe10 use skipSpace() more 2018-01-26 02:57:09 -08:00
Krzysztof Kowalczyk f154ca398a use skipChar*()/backChar() more 2018-01-26 02:53:47 -08:00
Krzysztof Kowalczyk fc6cca7042 use skipChar* functions some more 2018-01-26 02:46:47 -08:00
Krzysztof Kowalczyk 7b6aa5cb3c add backChar and use it 2018-01-26 02:39:44 -08:00
Krzysztof Kowalczyk fade61e5b7 use skipCharN() more 2018-01-26 02:17:38 -08:00
Krzysztof Kowalczyk 2a19bc67f3 add skipCharN() and use it 2018-01-26 02:02:19 -08:00
Krzysztof Kowalczyk 68a053c1ce use skipChar() more 2018-01-26 01:54:36 -08:00
Krzysztof Kowalczyk e1781bdd2c use skipChar() and skipUntilChar() more 2018-01-26 01:53:21 -08:00
Krzysztof Kowalczyk b0862e4434 use skipUntilChar() 2018-01-26 01:49:58 -08:00
Krzysztof Kowalczyk ce3ef7474d move some code to parser.go 2018-01-26 01:42:23 -08:00
Krzysztof Kowalczyk 6a262aa6c5 add tests for SanitizeAnchorName() 2018-01-26 01:18:19 -08:00
Krzysztof Kowalczyk 8bb670d63d rename Markdown to Parser 2018-01-25 23:16:34 -08:00
Krzysztof Kowalczyk 26da860b55 switch to using interface{} for node data 2018-01-25 22:44:27 -08:00
Krzysztof Kowalczyk 904c88f346 tweak comments; add todo.md 2018-01-25 15:08:57 -08:00
Krzysztof Kowalczyk 49a9386a12 make it stand-alone by folding https://github.com/shurcooL/sanitized_anchor_name 2018-01-25 13:09:33 -08:00
Krzysztof Kowalczyk 78bcb2da26 update links 2018-01-25 13:06:17 -08:00
Krzysztof Kowalczyk 7557d13318 change package name 2018-01-25 13:01:19 -08:00
Pierre Neidhardt 2501229ba6 Rename Markdown()->Run() and Processor->Markdown 2017-06-05 21:42:05 +01:00
Pierre Neidhardt 3cc9341a19 Merge Parser into Processor 2017-05-29 10:52:11 +02:00
Vytautas Šaltenis 41159b3874 Fix bad merge 2017-02-14 21:58:46 +02:00
Vytautas Šaltenis a8c45a7349 Merge branch 'v2' into v2-functional-opts 2017-02-14 21:51:06 +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 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 ea57e93666 Several fixes after code review 2017-02-02 11:54:10 +02:00
Vytautas Šaltenis 120bb2fae1 Get rid of the preprocess stage
Yay!!
2016-11-10 21:49:58 +02:00
Vytautas Šaltenis d9ffdb7464 Use bytes.IndexByte to skip til EOL 2016-09-10 15:24:45 +03:00
Vytautas Šaltenis e0fc1a0cb1 Don't bother removing trailing newlines in code blocks
The code that collects the block bytes has already removed the trialing
newlines, so this heavyweight regexp machinery is actually doing
nothing.
2016-09-10 12:21:53 +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
Pierre Neidhardt fdbedcdb78 Export tree manipulation functions 2016-08-10 08:59:15 +05:30
Vytautas Šaltenis 6d7f5e1bca More lint: block.go 2016-07-27 21:40:45 +03:00
Vytautas Šaltenis cd2f079140 More lint: inline.go 2016-07-27 21:31:29 +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 3575453f08 Move a couple helpers to parser where they're used 2016-04-11 15:55:50 +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 02a5ce37ff Go style: Html{Block|Span} -> HTML{Block|Span} 2016-04-01 13:15:47 +03:00
Vytautas Šaltenis 4ba991937b Store cell alignment in own type instead of int 2016-04-01 11:44:59 +03:00
Vytautas Šaltenis c8eb73377e Fix typos 2016-04-01 11:22:13 +03:00
Vytautas Šaltenis 60026cc3c6 Make ListData a nested struct instead of pointer 2016-04-01 11:21:25 +03:00
Vytautas Šaltenis 7c95b7a189 Construct AST WIP: add block-level nodes
Build a partial tree by adding block nodes. The block nodes will then be
traversed and inline markdown parsed inside each of them. Tests are
broken at this point until the full tree is constructed.
2016-03-30 12:57:12 +03:00
Vytautas Šaltenis f8378658c0 Fix rendering of tables
Add proper capture groups to fix the order of bits and pieces.
2015-11-10 21:36:32 +02:00
Vytautas Šaltenis 91771dc3ef Redirect output to a capture buffer where necessary
Use CaptureWrites where output should go to a temp buffer instead of the
final output.
2015-11-10 21:36:32 +02:00
Vytautas Šaltenis 08233481ed Fix Begin/EndHeader to use the new 'out'-less interface
Remove the 'out' parameter. Also, instead of returning and passing the
position of TOC, use CopyWrites to capture contents of the header and
pass that captured buffer instead.
2015-11-10 21:36:32 +02:00
Vytautas Šaltenis 352ffdefa4 Remove a bunch of 'out' parameters from calls, WIP
Still not all of them, still broken.
2015-11-10 21:36:32 +02:00
Vytautas Šaltenis 7ec50399c3 Remove 'out' parameter from parser funcs
This only removes the parameter from declarations, everything is broken
at the moment.
2015-11-10 21:36:32 +02:00
Vytautas Šaltenis 6d6be3d2b2 Remove callback from Paragraph renderer event
Split Paragraph into two events: BeginParagraph and EndParagraph,
removing the need for callback.
2015-11-10 21:08:32 +02:00
Vytautas Šaltenis af1b26fa04 Remove callback from List renderer event
Split List into two events: BeginList and EndList, removing the need for
callback.
2015-11-10 21:08:32 +02:00
Vytautas Šaltenis 82be6cab6d Remove callback from Header renderer event
Split Header into two events: BeginHeader and EndHeader, removing the
need for callback.
2015-11-10 21:08:32 +02:00