Commit Graph

391 Commits

Author SHA1 Message Date
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
Vytautas Šaltenis
e3cbadc5c9 Bump version 2015-12-06 19:26:14 +02:00
Vytautas Šaltenis
ce3ffa70a0 Merge pull request #222 from icco/parens
Allow parentheses inside of links
2015-12-06 18:44:17 +02:00
Nat Welch
1bb1fa9e95 remove check that brace is > 0 2015-12-05 02:00:36 +00:00
Nat Welch
c1d4a77100 Fix comment formatting and spelling 2015-12-05 02:00:23 +00:00
Nat Welch
45f5800b75 Get tests to pass 2015-11-29 00:08:48 +00:00
Nat Welch
1622f8f312 Apply @miekg's patch
From 99ce7134f6.patch
2015-11-26 22:11:25 +00:00
Vytautas Šaltenis
300106c228 Merge pull request #219 from FooSoft/master
Adding a link to Md2Vim.
2015-11-17 09:23:12 +02:00
Alex Yatskov
7d22880556 Adding a link to Md2Vim. 2015-11-17 12:58:23 +09:00
Dmitri Shuralyov
0b647d0506 Use more idiomatic form for set of strings.
This is a better style for a set, since each value can only be present
or absent.

With bool as value type, each value may be absent, or true or false. It
also uses slightly more memory.
2015-11-09 21:18:55 -08:00
Vytautas Šaltenis
18432fc942 Add a few missing HTML5 block tags
Closes #197.
2015-11-08 21:34:44 +02:00
Vytautas Šaltenis
f1ce82cb01 Sort block tag list alphabetically 2015-11-08 21:33:20 +02:00
Vytautas Šaltenis
510be64de0 Merge pull request #216 from russross/issue-194
Fix footnote following an exclamation point
2015-11-04 21:40:57 +02:00
Vytautas Šaltenis
f21f067121 Merge pull request #215 from russross/issue-193
Fix nested footnotes
2015-11-04 21:37:52 +02:00
Vytautas Šaltenis
c5943e0685 Reformat a dustball of ifs into a switch statement 2015-11-04 21:32:53 +02:00
Vytautas Šaltenis
a58274acef Minor style fix: declare ref first in a loop 2015-11-04 21:07:39 +02:00
Vytautas Šaltenis
ca8c21a297 Fix footnote following an exclamation point
Link parser interpreted the sequence "![^foo]" as an image, but if
footnote extension is enabled, it's quite clear that it should be
interpreted as a footnote following something with an exclamation point
at the end.

Closes #194.
2015-11-03 20:52:36 +02:00
Vytautas Šaltenis
c29209fcda Add String() method to reference struct 2015-11-02 20:24:34 +02:00
Vytautas Šaltenis
9e68ff937b Fix nested footnotes
This is both nasty and neat at the same time. All the code could handle
nested footnotes just fine, the only place that was not working was the
final loop that printed the list. The loop was in a range form, which
couldn't account for another footnote being inserted while processing
existing ones. Changing the loop to the iterative form solves that.

Closes #193.
2015-11-02 20:17:46 +02:00