Skip to content

Fix trailing <br>s added in lists with EXTENSION_HARD_LINE_BREAK enabled#686

Open
thebaer wants to merge 1 commit into
russross:masterfrom
writeas:fix-li-brs
Open

Fix trailing <br>s added in lists with EXTENSION_HARD_LINE_BREAK enabled#686
thebaer wants to merge 1 commit into
russross:masterfrom
writeas:fix-li-brs

Conversation

@thebaer

@thebaer thebaer commented Jul 2, 2021

Copy link
Copy Markdown

Previously, with EXTENSION_HARD_LINE_BREAK enabled, <li>s would contain unnecessary <br />s at the end of each item. It was especially noticeable by the vertical space this left following an ordered or unordered list.

This fixes that by also stripping trailing <br />s from individual list items when this extension is enabled.

One shortcoming of this patch: it does not completely fix the issue in nested lists, as far as the markup goes -- but the visual issues are gone, at least. I can work on fully fixing the markup if there's interest in that.

Input:

* One
* Two

Paragraph
Previous ResultFixed Result
<ul>
<li>One<br /></li>
<li>Two<br />
<br /></li>
</ul>
 
<p>Paragraph</p>
<ul>
<li>One</li>
<li>Two</li>
</ul>
 
<p>Paragraph</p>
Previously, with EXTENSION_HARD_LINE_BREAK enabled, <li>s would contain unnecessary <br />s at the end of each item. It was especially noticeable by the vertical space this left at the end of an ordered or unordered list.

This fixes that by stripping trailing <br />s from individual list items while in the process of stripping trailing newlines.

One shortcoming of this patch: it does not fix the issue in *nested* lists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant