"Fix" markdown html printing#18467
Conversation
commit: |
|
|
||
| export const disableHtmlFLowHack = () => { | ||
| enabled = false; | ||
| }; |
| _world_. </pre> | ||
| _world_. | ||
|
|
||
| </pre> |
There was a problem hiding this comment.
Maybe it's better to exclude htmlRawNames from hacked htmlBlockNames?
https://github.com/micromark/micromark/blob/774a70c6bae6dd94486d3385dbd9a0f14550b709/packages/micromark-util-html-tag-name/index.js#L93
There was a problem hiding this comment.
The htmlRawNames check is above the htmlBlockNames check, should be fine? https://github.com/micromark/micromark/blob/774a70c6bae6dd94486d3385dbd9a0f14550b709/packages/micromark-core-commonmark/dev/lib/html-flow.js#L297C36-L297C48
There was a problem hiding this comment.
Ah, didn't notice that we added extra new line?
There was a problem hiding this comment.
Yes, the extra new line in <pre> is problematic.
There was a problem hiding this comment.
Hmm but the previous behavior removing a trailng newline can be also problematic... I'll see it later.
There was a problem hiding this comment.
There was a problem hiding this comment.
Let' keep it this way for now.
There was a problem hiding this comment.
@fisker
I find this case itself don't make sense enough now. I missed the resulting HTML #18467 (comment) is broken. It contains mismatching <p> and <pre>, say, ordering as <p>...<pre>...</p>...</pre>.
So I consider we don't need to care the number of spaces / newlines for this case. It is unclear whether it's <pre> or not.
I want to hear your opinion.
There was a problem hiding this comment.
Clearly, CommonMark doesn't treat it <pre> as HTML in this case, so I think we are safe to change whitespace inside it.
Let's pretend <pre> is not there.
<table><tr><td>
<pre>
**Hello**,
_world_.
</pre>
</td></tr></table>
<table><tr><td>
pre
**Hello**,
_world_.
pre
</td></tr></table>
I can see they format to the same result now (regardless of --prose-wrap).
|
@seiyab Are you fine with this approach? |
|
Looks good except #18467 (comment) as cursory review. I'll see deeper. |
Description
Checklist
docs/directory).changelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md.