Remove extra soft break for tasklist (#8142)

Browser will display the extra newline character between checkbox and
text as a space, which make tasklist items cannot be aligned.

I just remove it.
This commit is contained in:
black-desk 2022-06-24 00:59:11 +08:00 committed by GitHub
parent 3876f15b45
commit 2abf56f508
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 25 deletions

View file

@ -502,7 +502,7 @@ listItemToHtml opts bls
let checkbox = if checked
then checkbox' ! A.checked ""
else checkbox'
checkbox' = H.input ! A.type_ "checkbox" ! A.disabled "" >> nl
checkbox' = H.input ! A.type_ "checkbox" ! A.disabled ""
isContents <- inlineListToHtml opts is
bsContents <- blockListToHtml opts bs
return $ constr (checkbox >> isContents) >> bsContents

View file

@ -6,10 +6,8 @@ tests adapted from <https://github.github.com/gfm/#task-list-items-extension->
- [x] bar
^D
<ul class="task-list">
<li><input type="checkbox" disabled="" />
foo</li>
<li><input type="checkbox" disabled="" checked="" />
bar</li>
<li><input type="checkbox" disabled="" />foo</li>
<li><input type="checkbox" disabled="" checked="" />bar</li>
</ul>
```
@ -22,15 +20,12 @@ bar</li>
- [ ] bim
^D
<ul class="task-list">
<li><input type="checkbox" disabled="" checked="" />
foo<ul class="task-list">
<li><input type="checkbox" disabled="" />
bar</li>
<li><input type="checkbox" disabled="" checked="" />
baz</li>
<li><input type="checkbox" disabled="" checked="" />foo<ul
class="task-list">
<li><input type="checkbox" disabled="" />bar</li>
<li><input type="checkbox" disabled="" checked="" />baz</li>
</ul></li>
<li><input type="checkbox" disabled="" />
bim</li>
<li><input type="checkbox" disabled="" />bim</li>
</ul>
```
@ -58,26 +53,21 @@ paragraph
- [x] checked
^D
<ul>
<li><input type="checkbox" disabled="" />
unchecked</li>
<li><input type="checkbox" disabled="" />unchecked</li>
<li>plain item</li>
<li><input type="checkbox" disabled="" checked="" />
checked</li>
<li><input type="checkbox" disabled="" checked="" />checked</li>
</ul>
<p>paragraph</p>
<ol type="1">
<li><input type="checkbox" disabled="" />
ordered unchecked</li>
<li><input type="checkbox" disabled="" />ordered unchecked</li>
<li>[] plain item</li>
<li><input type="checkbox" disabled="" checked="" />
ordered checked</li>
<li><input type="checkbox" disabled="" checked="" />ordered checked</li>
</ol>
<p>paragraph</p>
<ul class="task-list">
<li><p><input type="checkbox" disabled="" />
list item with a</p><p>second paragraph</p></li>
<li><p><input type="checkbox" disabled="" checked="" />
checked</p></li>
<li><p><input type="checkbox" disabled="" />list item with
a</p><p>second paragraph</p></li>
<li><p><input type="checkbox" disabled="" checked="" />checked</p></li>
</ul>
```