Commit Graph

409 Commits

Author SHA1 Message Date
Vytautas Šaltenis
6d1ef893fc Merge pull request #354 from russross/readme-for-v2
Document V2 in master README
2017-10-11 21:22:19 +03:00
Vytautas Šaltenis
8249792ba8 Update on import paths and dep transitive import FAQ
Update usage and import paths with and without package management.
Document the dep transitive dependency issue and how to get around it.
Couple more minor edits.
2017-10-07 12:41:58 +03:00
Vytautas Šaltenis
8ad7e40db0 Update README with the latest changes from v2 2017-10-07 11:14:28 +03:00
Vytautas Šaltenis
a03b7ee643 Add v1 import path, fix Bluemonday code snippet 2017-10-07 11:14:28 +03:00
Vytautas Šaltenis
52dd06192f Badges back to heading, reference v1 docs explicitly 2017-10-07 11:14:28 +03:00
Vytautas Šaltenis
ad4c953876 Put row of badges above the top level heading 2017-10-07 11:14:28 +03:00
Vytautas Šaltenis
74be510331 Document V2 in master README 2017-10-07 11:14:28 +03:00
Vytautas Šaltenis
4048872b16 Merge pull request #379 from bep/guillemets
Add Smartypants support for French Guillemets
2017-07-28 20:53:26 +03:00
Bjørn Erik Pedersen
4ca8c28b21 Add Smartypants support for French Guillemets
This commits adds flag `HTML_SMARTYPANTS_QUOTES_NBSP` which, when combined with `HTML_USE_SMARTYPANTS` will insert non-breaking spaces between the double quotes and the contained text.

This is mostly relevant for use in French  with `HTML_SMARTYPANTS_ANGLED_QUOTES`.

It should not hurt existing code path in the performance department:

```
name                     old time/op    new time/op    delta
SmartDoubleQuotes-4    2.58µs ± 1%    2.58µs ± 1%   ~             (p=1.000 n=5+5)

name                     old alloc/op   new alloc/op   delta
SmartDoubleQuotes-4    5.27kB ± 0%    5.27kB ± 0%   ~     (all samples are equal)

name                     old allocs/op  new allocs/op  delta
SmartDoubleQuotes-4      13.0 ± 0%      13.0 ± 0%   ~     (all samples are equal)
```

Fixes #378
2017-07-27 22:08:20 +02:00
Vytautas Šaltenis
067529f716 Merge pull request #366 from choueric/master
fix duplicate and recursive footnotes. (#241)
2017-06-10 20:02:32 +03:00
choueric
5b2fb1b893 use map[string]struct{} as a set.
Use map[string]struct{} instead of map[string]bool to implement a set
and reduce memory space.
2017-06-10 22:24:27 +08:00
choueric
8c89af6200 add 'notesRecord' to check footnote existence fast
It is necessary to use vector for 'notes' instead of map to keep
footnotes ordered. But checking for presence in a vector is not
efficient. So add a map variable 'notesRecord' to tackle this problem.
2017-06-09 10:20:58 +08:00
choueric
a20399916c fix duplicate and recursive footnotes. (#241)
Fix the infinite loop when there is a self-refer footnote by checking if
the reference is already added into parser.notes.

It also fixes of creating duplicate footnotes through this modification.

Add coresponding testcase.
2017-06-08 14:43:56 +08:00
Dmitri Shuralyov
0ba0f2b6ed Document SanitizedAnchorName algorithm, copy implementation. (#352)
The goal of this change is to reduce number of non-standard library
packages (repositories) that blackfriday imports from 1 to 0, and in
turn, reduce the cost of importing blackfriday into other projects.

Do so by documenting the algorithm of SanitizedAnchorName, and include
a copy of the small function inside blackfriday itself. The same
functionality continues to be available in the original location,
github.com/shurcooL/sanitized_anchor_name.Create. It can be used by
existing users and those that look for a small package, and don't need
all of blackfriday functionality. Existing users of blackfriday can use
the new SanitizedAnchorName function directly and avoid an extra
package import.

Resolves #350.
2017-05-09 02:07:14 -04:00
Vytautas Šaltenis
b253417e1c Merge pull request #334 from choueric/master
add an extension to handle Chinese (or CJK) newlines.
2017-04-13 20:36:32 +03:00
choueric
f0bb45f44c modify testcase of joinLine.
1. delete testdata 'zhJoinLines.txt'.
2. move the testcase from markdown_test.go into block_test.go.
2017-03-17 17:21:30 +08:00
choueric
8098dab4eb add testcase for joinLines extension 2017-02-22 09:18:21 +08:00
choueric
3ffe8c7f6b add extension to join lines 2017-02-22 09:15:46 +08:00
Kévin Dunglas
5f33e7b787 Document using fenced code blocks with bluemonday (#309)
Document using fenced code blocks with bluemonday
2016-10-03 19:27:22 +03:00
Dmitri Shuralyov
35eb537633 Set LIST_ITEM_END_OF_LIST when list is at end of document. (#305)
The LIST_ITEM_END_OF_LIST flag is an internal flag passed to renderers
when rendering list items. It's normally set for the last item in the
list.

This change fixes the issue where that flag wasn't set in situations
where the Markdown document ends with the list being the last block
level item in it.

The cases above detect and set LIST_ITEM_END_OF_LIST flag when the list
ends because another thing begins, but they miss it when the end of
document is reached.

No tests here because this subtle internal behavior is hard to test and
would require quite a bit of testing/mock infrastructure.

Helps shurcooL/markdownfmt#30.
2016-09-08 23:28:54 -07:00
Dmitri Shuralyov
93622da34e Make newline mandatory for opening fence line. (#281)
This was an unintended typo/mistake in #280.

This is stricter, and it's fine. The opening fence line will always need to have a newline.

Add another test for isFenceLine.
2016-07-16 11:34:03 -04:00
Vytautas Šaltenis
4e6f303e8d Merge pull request #280 from russross/fix-279-and-refactor
Fix fenced code block rendering with content resembling references.
2016-07-15 22:37:58 +03:00
Dmitri Shuralyov
a5812bb8f2 Improve fenced code block detection for first pass.
In first pass, there may not be a trailing newline after a fenced code
block yet. Make newline optional in isFenceLine when calling
fencedCodeBlock to detect the fenced code block it anyway. This is more
complex, but it avoids creating temporary buffers or modifying input in
order to maintain performance (see #148).

Document and rename fencedCode to fencedCodeBlock.

Add regression tests.

Fixes #279.
2016-07-15 15:07:43 -04:00
Dmitri Shuralyov
0049676599 Improve fence line detection.
Rename isFenceCode to isFenceLine, document it, add tests.

Add support for making newline optional, this will be needed in future
commits.
2016-07-15 14:59:57 -04:00
Dmitri Shuralyov
96537c6eaa Create a place for document-level unit tests.
These will be helpful for catching regressions or changes in behavior
to edge cases such as empty input, or specifically crafted inputs that
may cause panics, etc.

Move test for issue #172 there since it's a document-level test, not an
inline one.

Add test for issue #173.

Make some things more consistent.

Don't use a named receiver in methods that don't use it. This makes the
code more readable since one can more quickly tell the inputs to the
method.
2016-07-15 14:59:57 -04:00
Vytautas Šaltenis
1d6b8e9301 Merge pull request #266 from russross/avoid-unneeded-break
Avoid unneeded break statement.
2016-05-31 14:12:24 +03:00
Dmitri Shuralyov
b88a9bd458 Avoid unneeded break statement.
This is purely a style change with no behavior difference.

In Go (unlike most other languages), case statements in a switch
don't need an explicit break statement, it happens by default. Adding
it explicitly is possible, but has no effect.

In this case, having the break statement hurts readability because
it's hard to tell if it's a mistake, and the break was intended to
break out of the outer for loop, rather than do nothing for the switch
statement. So, remove it, to make it more clear that there is no
bug here.
2016-05-24 22:04:36 -07:00
Vytautas Šaltenis
2004188462 Merge pull request #264 from moorereason/iss263
Fix definition lists that contain other lists
2016-05-10 22:09:22 +03:00
Cameron Moore
acc07e6144 Fix definition lists that contain other lists
Fixes #263
2016-05-06 13:27:55 -05:00
Vytautas Šaltenis
43529be397 Merge pull request #261 from moorereason/iss235
Fix adjacent list merging
2016-05-02 20:28:48 +03:00
Cameron Moore
0529888f55 Fix adjacent list merging
Prevent adjacent lists of differing types from being merged into a
single list.  No options are provided to enable the previous behavior.

Fixes #235
2016-05-02 09:02:35 -05:00
Dmitri Shuralyov
fc997ac2ba Travis: Run gofmt -s, go vet, go test -race, add Go 1.6.
Also make tip a fast-finish allowed failure. That way, if CI fails on
tip due to a temporary issue with tip, it will not break build status.
However, it's still possible to see tip build status by looking at CI
details page.

Do not run go vet with Go 1.4 or older since it's not included in the
standard library, and it's no longer available in external standard
library.

Add godoc badge to README.md.
2016-04-28 22:47:04 -07:00
Vytautas Šaltenis
151efb040f Merge pull request #250 from tomkwok/master
Fix regession: index out of range panic in reference link (#172, #173)
2016-04-21 11:09:30 +03:00
Tom Kwok
69f51afe42 Add test for issue 172 2016-04-03 21:08:32 +08:00
Tom Kwok
232d06cf99 Fix regression: index out of range panic in reference link (#172, #173) 2016-04-02 22:13:43 +08:00
Vytautas Šaltenis
b43df972fb Merge pull request #247 from shawnps/patch-1
fix typo
2016-03-16 09:29:03 +02:00
Shawn Smith
1d94959fea fix typo 2016-03-16 15:21:50 +09:00
Vytautas Šaltenis
006144af03 Merge pull request #234 from shawnps/gofmt
gofmt -s
2016-01-24 13:12:56 +02:00
shawnps
2ee51ae2a0 gofmt -s 2016-01-22 16:04:49 -08:00
Vytautas Šaltenis
c8875c0ed4 Merge pull request #229 from russross/issue-228
Fix bug with gathering list item lines
2015-12-30 17:42:28 +02:00
Vytautas Šaltenis
fc6236fc55 Fix bug with gathering list item lines
Instead of swallowing an empty line and then reintroducing it back again
in certain cases, collect the list item body in an unaltered form and
let the recursive parsing call sort things out.

Fixes issue #228.
2015-12-26 20:18:22 +02:00
Vytautas Šaltenis
b8031576aa Merge pull request #225 from russross/issue-165
Implement support for CDATA section
2015-12-25 13:14:44 +02:00
Vytautas Šaltenis
ee63ffd3e2 Fix initialisms in function names 2015-12-25 13:04:56 +02:00
Vytautas Šaltenis
f5ac2ddf7a Add a few more CDATA tests 2015-12-16 20:53:40 +02:00
Vytautas Šaltenis
594d923645 Convert constant variables into consts 2015-12-16 20:51:44 +02:00
Vytautas Šaltenis
05a79218ed Implement support for CDATA section
Fixes #165.
2015-12-14 20:57:40 +02:00
Vytautas Šaltenis
d18b67ae0a Add more tests for emphasised text
Including EXTENSION_NO_INTRA_EMPHASIS. These nail down a fix for #178
that was a side effect of cc3cc10.
2015-12-12 19:18:59 +02:00
Vytautas Šaltenis
3c4a488ada Merge pull request #224 from russross/issue-180
Fix for #180
2015-12-11 20:25:12 +02:00
Vytautas Šaltenis
fc740701cf Cosmetics: fix comment placement and import order 2015-12-10 21:03:21 +02:00
Vytautas Šaltenis
bcd6dd8711 Don't require the input to end with a newline
Technically, not ending a line with a newline is wrong, but this blunder
is so pervasive that we have no other choice but to live with it.

Fixes #180.
2015-12-10 20:52:47 +02:00