Commit Graph

542 Commits

Author SHA1 Message Date
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
e0df702112 Merge pull request #382 from russross/v2-final-docs-fixes
Several small documentation fixes
2017-08-01 23:01:04 +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
f42ca5bf18 Merge pull request #377 from russross/v2-catch-up-readme
Catch up README with the latest changes in code
2017-07-26 21:43:53 +03:00
Vytautas Šaltenis
f86f06b532 Merge pull request #376 from russross/v2-improve-renderer-368
v2: improve Renderer and fix #368
2017-07-26 21:42:39 +03:00
Vytautas Šaltenis
427717f991 Use io.WriteString instead of w.Write([]byte(str)) 2017-07-10 19:11:30 +03:00
Vytautas Šaltenis
257ccba98f Catch up README with the latest changes in code 2017-07-09 16:27:38 +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
70c446a327 Merge pull request #365 from Ambrevar/v2
Merge Parser into Processor
2017-06-09 19:18:05 +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
e7910a813f Merge pull request #327 from russross/readme-update
Update README for v2
2017-05-06 19:33:15 +03:00
Vytautas Šaltenis
af57319fac Merge pull request #328 from russross/v2-functional-opts
Change the public interface to use functional options
2017-05-06 19:31:47 +03: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
5ebfae50aa Merge pull request #331 from russross/v2-fix-180-again
Fix #180 again
2017-02-14 21:40:27 +02:00
Vytautas Šaltenis
b98e306853 Merge pull request #332 from russross/v2-rename-headers-to-headings
Fix all headings wrongly referred to as headers
2017-02-14 21:17:32 +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
ad7f7c56d5 Merge pull request #322 from russross/v2-perf-tweaks
V2 perf tweaks
2017-02-02 17:08:19 +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
ea57e93666 Several fixes after code review 2017-02-02 11:54:10 +02:00
Vytautas Šaltenis
f805c775f5 HTTPS allthethings! 2017-01-27 12:13:59 +02:00
Vytautas Šaltenis
fb56a7e01e Update README for v2 2017-01-26 13:30:06 +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
3d1baecb3d Merge pull request #323 from russross/ditch-skip-style
Ditch SkipStyle flag
2016-12-07 21:00:43 +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 Šaltenis
120bb2fae1 Get rid of the preprocess stage
Yay!!
2016-11-10 21:49:58 +02:00
Vytautas Saltenis
22a3e5b744 Avoid calling bytes.Split() in appendLanguageAttr
This avoids some allocs.
2016-10-29 12:09:34 +03:00
Vytautas Saltenis
9357a8f949 Simplify inline() even more
* Move handler call inside the inner loop's 'if handler != nil' clause
* Move appender of possible tail bytes outside of loop
* Get rid of outer loop
* Rename i -> beg

Again, this does not seem to gain much performance, but makes the code
significantly more readable.
2016-10-29 11:31:21 +03:00
Vytautas Saltenis
6438ce6de8 Avoid some conditionals in inline parser
Rearrange inline parser a little bit to check less conditionals for
every byte.

* Add early check for len(data) == 0
* Move 'for i < len(data)' check inside the (rarer) positive clause of
  trigger result handling
* A check for newline turned out to be redundant
* Look up p.inlineCallback only once

All that does not gain much performance in itself, but doesn't hurt and
makes the code structure simpler, which will hopefully allow further
streamlining.
2016-10-29 10:10:22 +03:00
Vytautas Šaltenis
52676fb005 Merge pull request #314 from Ambrevar/v2consttype
v2: Add missing type to TableAlignment* constants
2016-10-09 10:26:09 +03:00
Pierre Neidhardt
627dc87cad Add missing type to TableAlignment* constants 2016-10-09 08:43:40 +05:30
Vytautas Šaltenis
2b483a8555 Merge pull request #310 from Ambrevar/v2FixWalkNoContainer
v2: Fix walk with non-container root nodes
2016-10-08 18:24:09 +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
461803619b Simplify escapeHTML and uncomment it's benchmark
Simplify and optimize escapeHTML as per @Ambrevar's suggestion: lean on
the fact that we're dealing with bytes: declare a 256-element array with
most of it filled with zeros, except for the few slots that need
escaping. This avoids some conditionals in a tight loop.

Also, uncomment it's benchmark.
2016-10-08 18:02:28 +03:00
Pierre Neidhardt
14a0c487b8 Fix walk with non-container root nodes
When passed a non-container root node, the former algorithm would go on
walking down the rest of the tree beyond the root.

The former walk fix was supposed to do that but somehow the code
disappeared in the process.
2016-10-05 11:04:51 +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
1aa82c4039 Make golint happy: fix method receiver
golint insists on uniform receiver names.
2016-09-17 19:36:55 +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
Vytautas Šaltenis
64d8e9ed79 Merge pull request #300 from Ambrevar/rmLaTeX
v2: Remove the LaTeX renderer stub and point to Ambrevar's implementation
2016-09-12 19:57:33 +03:00
Vytautas Šaltenis
d9ffdb7464 Use bytes.IndexByte to skip til EOL 2016-09-10 15:24:45 +03:00
Vytautas Šaltenis
993325d13f Roll our own implementation of HTML escaper 2016-09-10 14:33:37 +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
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