Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thebaer
Copy link

@thebaer thebaer commented Jul 2, 2021

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant