diff options
| author | John MacFarlane <[email protected]> | 2025-03-14 15:07:16 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2025-03-14 15:07:16 -0700 |
| commit | 28eca1e41e32a4f76645df6ea6de4f746a9e3e62 (patch) | |
| tree | 983e132a6d335375054445e5e966fb3624bc6c6e /test | |
| parent | 7301daa799830065e8a69a03cebd756f8317bbea (diff) | |
Markdown reader: remove some misguided list fanciness.
Previously we tried to handle things like commented out list
items:
- one
<!--
- two
-->
- three
and also things like:
- one `and
- two` and
But the code we added to handle these cases caused problems with
other, more straightforward things, like:
- one
- ```
code
```
- three
So we are rolling back all the fanciness, so that the markdown
parser now behaves more like the commonmark parser, in which
indicators of block-level structure always take priority over
indicators of inline structure.
Closes #9865. Closes #7778. See also #5628.
Diffstat (limited to 'test')
| -rw-r--r-- | test/Tests/Readers/Markdown.hs | 7 | ||||
| -rw-r--r-- | test/command/7778.md | 59 | ||||
| -rw-r--r-- | test/command/9865.md | 53 | ||||
| -rw-r--r-- | test/markdown-reader-more.native | 8 |
4 files changed, 114 insertions, 13 deletions
diff --git a/test/Tests/Readers/Markdown.hs b/test/Tests/Readers/Markdown.hs index aded6c663..ed0d59843 100644 --- a/test/Tests/Readers/Markdown.hs +++ b/test/Tests/Readers/Markdown.hs @@ -188,7 +188,6 @@ tests = [ testGroup "inline code" , ("after literal backticks", ["`x``- x`" ], [code "x``- x" ]) ] lis = ["`text","y","x`"] - lis' = ["text","y","x"] bldLsts w lsts txts = let (res, res', f) = foldr (\((_, _, lt), lc) (acc, tacc, t) -> @@ -210,12 +209,6 @@ tests = [ testGroup "inline code" =?> bldLsts plain lsts lis | lsts <- [ [i, j, k] | i <- lists, j <- lists, k <- lists] ] - <> [ "lists with newlines and indent in backticks" =: - T.intercalate ("\n" <> T.replicate 4 " ") (zipWith (\i (_, lt, _) -> lt <> i) lis (l:ls)) - =?> let (_, _, f) = l - in f [plain $ code $ T.intercalate (T.replicate 5 " ") $ "text" : zipWith (\i (_, lt, _) -> lt <> i) (drop 1 lis') ls] - | (l:ls) <- [ [i, j, k] | i <- lists, j <- lists, k <- lists] - ] <> [ "lists with blank lines and indent in backticks" =: T.intercalate ("\n\n" <> T.replicate 4 " ") (zipWith (\i (_, lt, _) -> lt <> i) lis (l:ls)) <> "\n" diff --git a/test/command/7778.md b/test/command/7778.md new file mode 100644 index 000000000..7e89141c2 --- /dev/null +++ b/test/command/7778.md @@ -0,0 +1,59 @@ +Here the thing to remember is that block level structure indications +take precedence over inline level structure indications: + +``` +% pandoc +Term +: Def +<!-- +: comment def +--> +^D +<dl> +<dt>Term</dt> +<dd> +Def <!– +</dd> +<dd> +comment def –> +</dd> +</dl> +``` + +``` +% pandoc +Term +: Def +test <!-- +: comment def +and --> +^D +<dl> +<dt>Term</dt> +<dd> +Def test <!– +</dd> +<dd> +comment def and –> +</dd> +</dl> +``` + +``` +% pandoc +Term +: Def +`code +: comment def +more code` +^D +<dl> +<dt>Term</dt> +<dd> +Def `code +</dd> +<dd> +comment def more code` +</dd> +</dl> +``` diff --git a/test/command/9865.md b/test/command/9865.md new file mode 100644 index 000000000..5641629d2 --- /dev/null +++ b/test/command/9865.md @@ -0,0 +1,53 @@ +```` +% pandoc +- example 1 +- ``` + one + two + ``` +- list item three +^D +<ul> +<li>example 1</li> +<li><pre><code>one +two</code></pre></li> +<li>list item three</li> +</ul> +```` + +```` +% pandoc +- example 3 +- ``` +one +two +``` +- list item three +^D +<ul> +<li>example 3</li> +<li><pre><code>one +two</code></pre></li> +<li>list item three</li> +</ul> +```` + +Here is a case that we used to handle differently, but +#9865 aligns pandoc's markdown parser with commonmark in letting +block level structure take precedence over inline level structure. + +```` +% pandoc +- a <!-- + +- b + +--> +- c +^D +<ul> +<li><p>a <!–</p></li> +<li><p>b</p></li> +</ul> +<p>–> - c</p> +```` diff --git a/test/markdown-reader-more.native b/test/markdown-reader-more.native index 148cba944..cf5de564d 100644 --- a/test/markdown-reader-more.native +++ b/test/markdown-reader-more.native @@ -200,12 +200,8 @@ Pandoc , Str "item" ] , BulletList - [ [ Plain - [ Str "one" - , SoftBreak - , RawInline (Format "html") "<!--\n- two\n-->" - ] - ] + [ [ Plain [ Str "one" , SoftBreak , Str "<!\8211" ] ] + , [ Plain [ Str "two" , SoftBreak , Str "\8211>" ] ] , [ Plain [ Str "three" ] ] ] , Header |
