[Markdown] vendor html-text#18515
Conversation
commit: |
✅ Deploy Preview for prettier ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
9af30ab to
d1c5fe8
Compare
| node.type === "html" && | ||
| previous.type === "html" && | ||
| previous.position.end.line + 1 === node.position.start.line; | ||
| const isBlockHtmlWithoutBlankLineBetweenPrevParagraph = |
There was a problem hiding this comment.
This is equivalent to isInlineHtmlInterruptingParagraph. I updated the name to match current parser behavior. I moved it up because it's similar to isBlockHtmlWithoutBlankLineBetweenPrevHtml above.
| const isBlockHtmlWithoutBlankLineBetweenPrevParagraph = | ||
| options.parser !== "mdx" && | ||
| node.type === "html" && | ||
| previous.type === "paragraph" && |
There was a problem hiding this comment.
Maybe we should not care what previous sibling is?
There was a problem hiding this comment.
I mean, always print html on own line if it was.
There was a problem hiding this comment.
This part is about not printing double hardline (= preceding blank line) rather than owning line. Block HTML elements already always own their line. The idea not considering previous node type here sounds a reasonable choice, though its about having a blank line.
Should we get even inline HTMLs own their line if they did? It might be complex because they are in paragraphs and will also affects (and maybe be affected by) next nodes.
There was a problem hiding this comment.
If we don't care previous sibling type: seiyab@7719e5a
We can cherry-pick if you prefer it.
Description
This PR tackles #18277 (comment) and #18498 (comment).
Status: Just a PoC. I'm not sure enough that it's worth vendoring the tokenizer. I'll also submit a PR to micromark.Status:
Checklist
docs/directory).changelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md.