diff options
author | Andrey Makarov <ph.makarov@gmail.com> | 2022-08-16 01:37:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-15 18:37:45 -0400 |
commit | 9f408ea9430b104eb6c14a84d7a1650bf115b6a0 (patch) | |
tree | 61a9473eb3e4cdd5ef6996fec01bd254c7f8127d /tests/stdlib | |
parent | c579243e0cdba83a07357637d4bcef8594263207 (diff) | |
download | Nim-9f408ea9430b104eb6c14a84d7a1650bf115b6a0.tar.gz |
Don't require blank line before Markdown code (#20215)
Fixes bug reported in https://github.com/nim-lang/Nim/pull/20189 affecting nimforum.
Diffstat (limited to 'tests/stdlib')
-rw-r--r-- | tests/stdlib/trst.nim | 39 | ||||
-rw-r--r-- | tests/stdlib/trstgen.nim | 4 |
2 files changed, 41 insertions, 2 deletions
diff --git a/tests/stdlib/trst.nim b/tests/stdlib/trst.nim index 70d992166..d1d7a3f00 100644 --- a/tests/stdlib/trst.nim +++ b/tests/stdlib/trst.nim @@ -576,6 +576,45 @@ suite "RST parsing": # | | # | \ indentation of exactly two spaces before 'let a = 1' + test "no blank line is required before or after Markdown code block": + let inputBacktick = dedent""" + Some text + ``` + CodeBlock() + ``` + Other text""" + let inputTilde = dedent""" + Some text + ~~~~~~~~~ + CodeBlock() + ~~~~~~~~~ + Other text""" + let expected = dedent""" + rnInner + rnParagraph + rnLeaf 'Some' + rnLeaf ' ' + rnLeaf 'text' + rnParagraph + rnCodeBlock + [nil] + rnFieldList + rnField + rnFieldName + rnLeaf 'default-language' + rnFieldBody + rnLeaf 'Nim' + rnLiteralBlock + rnLeaf ' + CodeBlock()' + rnLeaf ' ' + rnLeaf 'Other' + rnLeaf ' ' + rnLeaf 'text' + """ + check inputBacktick.toAst == expected + check inputTilde.toAst == expected + test "option list has priority over definition list": check(dedent""" --defusages diff --git a/tests/stdlib/trstgen.nim b/tests/stdlib/trstgen.nim index 42e463a04..a70b3f699 100644 --- a/tests/stdlib/trstgen.nim +++ b/tests/stdlib/trstgen.nim @@ -389,7 +389,7 @@ Some chapter ~~~~~ """ - let output9good = input9good.toHtml + let output9good = input9good.toHtml(preferRst) doAssert "<h1 id=\"level1\">Level1</h1>" in output9good doAssert "<h2 id=\"level2\">Level2</h2>" in output9good doAssert "<h3 id=\"level3\">Level3</h3>" in output9good @@ -419,7 +419,7 @@ Some chapter """ var error9Bad = new string - let output9Bad = input9Bad.toHtml(error=error9Bad) + let output9Bad = input9Bad.toHtml(preferRst, error=error9Bad) check(error9Bad[] == "input(15, 1) Error: new section expected (section " & "level inconsistent: underline ~~~~~ unexpectedly found, while " & "the following intermediate section level(s) are missing on " & |