diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2023-01-20 10:29:40 -0800 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2023-01-20 10:29:40 -0800 |
| commit | 6ebabd211882c245d05f0b8278c518ebacec2a4d (patch) | |
| tree | a957b393699a5789e810ddcb1068f044ed504f41 | |
| parent | 62e14233cd52f372e0ebb4897857b35864425063 (diff) | |
HTML writer: don't omit newlines in task lists.
| -rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 4 | ||||
| -rw-r--r-- | test/command/tasklist.md | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 3af53408b..0d9346a07 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -500,7 +500,9 @@ listItemToHtml opts bls checkbox' = H.input ! A.type_ "checkbox" isContents <- inlineListToHtml opts is bsContents <- blockListToHtml opts bs - return $ constr (checkbox >> isContents) >> bsContents + return $ constr (checkbox >> isContents) >> + (if null bs then mempty else nl) >> + bsContents -- | Construct table of contents from list of elements. tableOfContents :: PandocMonad m => WriterOptions -> [Block] diff --git a/test/command/tasklist.md b/test/command/tasklist.md index 65afe8a9c..caa8603f4 100644 --- a/test/command/tasklist.md +++ b/test/command/tasklist.md @@ -20,7 +20,8 @@ tests adapted from <https://github.github.com/gfm/#task-list-items-extension-> - [ ] bim ^D <ul class="task-list"> -<li><input type="checkbox" checked="" />foo<ul class="task-list"> +<li><input type="checkbox" checked="" />foo +<ul class="task-list"> <li><input type="checkbox" />bar</li> <li><input type="checkbox" checked="" />baz</li> </ul></li> @@ -64,8 +65,8 @@ paragraph </ol> <p>paragraph</p> <ul class="task-list"> -<li><p><input type="checkbox" />list item with a</p><p>second -paragraph</p></li> +<li><p><input type="checkbox" />list item with a</p> +<p>second paragraph</p></li> <li><p><input type="checkbox" checked="" />checked</p></li> </ul> ``` |
