mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-22 07:15:22 +00:00
Markdown code blocks part 2; migrate Nim Manual (#20080)
* Change headings underscored by `~~~` to `###` * Markdown code blocks part 2; migrate Nim Manual
This commit is contained in:
@@ -471,21 +471,34 @@ suite "RST parsing":
|
||||
rnLeaf '.'
|
||||
""")
|
||||
|
||||
let expectCodeBlock = dedent"""
|
||||
rnCodeBlock
|
||||
[nil]
|
||||
[nil]
|
||||
rnLiteralBlock
|
||||
rnLeaf '
|
||||
let a = 1
|
||||
```'
|
||||
"""
|
||||
|
||||
test "Markdown code blocks with more > 3 backticks":
|
||||
check(dedent"""
|
||||
````
|
||||
let a = 1
|
||||
```
|
||||
````""".toAst ==
|
||||
dedent"""
|
||||
rnCodeBlock
|
||||
[nil]
|
||||
[nil]
|
||||
rnLiteralBlock
|
||||
rnLeaf '
|
||||
````""".toAst == expectCodeBlock)
|
||||
|
||||
test "Markdown code blocks with ~~~":
|
||||
check(dedent"""
|
||||
~~~
|
||||
let a = 1
|
||||
```'
|
||||
""")
|
||||
```
|
||||
~~~""".toAst == expectCodeBlock)
|
||||
check(dedent"""
|
||||
~~~~~
|
||||
let a = 1
|
||||
```
|
||||
~~~~~""".toAst == expectCodeBlock)
|
||||
|
||||
test "Markdown code blocks with Nim-specific arguments":
|
||||
check(dedent"""
|
||||
|
||||
@@ -552,7 +552,7 @@ context1
|
||||
|
||||
context2
|
||||
"""
|
||||
let output1 = input1.toHtml
|
||||
let output1 = input1.toHtml(preferRst)
|
||||
doAssert "<hr" in output1
|
||||
|
||||
let input2 = """
|
||||
@@ -1616,3 +1616,8 @@ suite "local file inclusion":
|
||||
discard ".. code-block:: nim\n :file: ./readme.md".toHtml(error=error)
|
||||
check(error[] == "input(2, 20) Error: disabled directive: 'file'")
|
||||
|
||||
test "code-block file directive is disabled - Markdown":
|
||||
var error = new string
|
||||
discard "```nim file = ./readme.md\n```".toHtml(error=error)
|
||||
check(error[] == "input(1, 23) Error: disabled directive: 'file'")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user