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.
* 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
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.