-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix to filter out initial, final
<br>
s
Closes GH-66.
- Loading branch information
Showing
3 changed files
with
54 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
<p>alpha<br>bravo</p> | ||
<pre>charlie<br>delta</pre> | ||
<p><br></p> | ||
<p>echo<br></p> | ||
<p>foxtrot<br><br></p> | ||
<p><br>golf</p> | ||
<p><br><br>hotel</p> | ||
<p><br>india<br></p> | ||
<p><br><br>juliett<br><br></p> | ||
<h1><br>kilo</h1> | ||
<h1>lima<br></h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,19 @@ bravo | |
|
||
charlie | ||
delta | ||
|
||
echo | ||
|
||
foxtrot | ||
|
||
golf | ||
|
||
hotel | ||
|
||
india | ||
|
||
juliett | ||
|
||
# kilo | ||
|
||
# lima |
a02be0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this commit, the following will stop working in
rehype-remark
:@wooorm Is this expected? I expect this will preserve
<br>
in markdown.a02be0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. There isn’t a good reason to use initial and final
br
s:^-- this may look a bit different on a screen with/without the
br
, but it doesn’t have a different meaning.Or:
^-- These two are kept by this patch (and your code handler still runs)
a02be0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it possible to add extra new lines in markdown which is supported before.
a02be0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this library more as: “I have some crappy HTML from somewhere on the internet, make it readable in plain markdown”.
Closer to how the Reader functionality works on mac/ios, or alternatively mozilla/readability.
a02be0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it is not. The users was able to preserve all
<br>
s if they want, they can even preserve all parts of the output ast as a wholehtml
node, but it is now very difficult to do this after this commit. At least this is a BREAKING CHANGE.a02be0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is the goal of this project. To provide clean markdown.
Your issue was that invalid markdown was generated. That is now fixed. Correct markdown is now generated.
It fixed the problem you raised. You used a workaround before. That workaround does still work for semantic HTML. The workaround does not work for unsemantic HTML. Keeping unsemantic HTML in markdown is not a goal of this project.
Why are you using unsemantic HTML?
a02be0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is said
HTML in Markdown
is supported: https://github.com/syntax-tree/hast-util-to-mdast#html-in-markdownIs the mentioned
svg
alsounsemantic
?The current changes are fine to my own personally, but I don't think we should remove the ability to keep simple
<br>
.a02be0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, SVG has semantics in HTML. That example is fine.
br
also has semantics in HTML. If they are used in poems or addresses. Not if they just add some marginSee MDN for more info: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br
a02be0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still disagree with this clarification, because it's not documented anywhere AFAIK.
Removing a feature in a bug fix also seems wrong to me.