Commit Graph

424 Commits

Author SHA1 Message Date
Christian Oliff
f3ccc8fc06 https link to GitHub (#538) 2019-04-17 22:17:06 +03:00
Ignas Anikevicius
a477dd1646 Fix fenced code in lists (#521)
This attempts to fix #495 and #485.

Note the test cases which were added at the bottom of the list. The first added test case was passing even before the changes, but the second was not.
2019-01-24 10:23:35 +02:00
Iskander (Alex) Sharipov
13768b07fa readme: use fenced code blocks (#519)
It's more consistent and it's possible to mark code blocks with "go" hint,
so we get syntax highlighting on GitHub.
2019-01-20 20:42:03 +02:00
autopp
8c3eacd7a5 Fix checking of backslash in link text (#510) (#512) 2019-01-20 20:38:36 +02:00
Harald Nordgren
abafa45cd8 Bump Go versions (#499) 2018-11-15 22:38:43 +02:00
Bjørn Erik Pedersen
05f3235734 Add go.mod (#488) 2018-09-17 21:59:06 +03:00
Tim Fogarty
f1f45ab762 Fix block parsing for fenced code blocks in lists (#476)
This is a backport of the initial fix in v2 (#372).
2018-08-29 21:04:01 +03:00
Vytautas Šaltenis
46c73eb196
Add a link to bfchroma, glue library with Chroma (#400)
Chroma is a general purpose code highlighting library, and bfchroma
provides an easy to use glue layer for Blackfriday to interface with
Chroma.

Fixes #10.
2018-08-04 13:11:49 +03:00
Vytautas Šaltenis
34d6fae961
Don't run tests against ancient versions on Travis (#438)
Don't run tests against ancient versions on Travis.
2018-08-04 13:08:49 +03:00
Nathan Glenn
11635eb403 Accept info strings in code fences (#448)
* Accept info strings in code fences

According to the common mark standard, code fence info strings can be anything,
not just single words. Update the tests and parser accordingly.

The formatter already expected an info string with a language and HTML classes,
so this does not need to change. Update the LaTeX formatter to take the first
word of the info string as the language.

Fixes #410 (in v1).

* Don't output whole info string as code classes

This follows the common mark specification.

* run go fmt
2018-04-28 13:25:19 +03:00
Yoshiya Hinosawa
16ac584625 docs(README.md): fix typo (#451) 2018-04-26 21:50:03 +03:00
Vytautas Šaltenis
55d61fa8aa
Merge pull request #433 from IainHaslam/master
Fix HTML5 by removing rel="footnote" which is invalid.
2018-02-18 11:36:01 +02:00
Iain Haslam
338ca359c1 Fix HTML5 by removing rel="footnote" which is invalid.
Resolves #336.
2018-02-16 22:21:04 +00:00
Vytautas Šaltenis
8db9055e38
Merge pull request #432 from vassudanagunta/patch-1
Fix broken link to v2 in README
2018-02-12 10:28:20 +02:00
Vas Sudanagunta
e32caebbc7
Fix broken link to v2 in README 2018-02-07 15:16:47 -05:00
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