Html Inline semantics#151
Open
dillonkearns wants to merge 15 commits intohtml-fallbackfrom
Open
Conversation
…as inline HTML otherwise.
…g blocks and inlines to simplify user API.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inline HTML children are now typed as Inline
Previously,
HtmlInlinecontainedHtml Block, which meant inline HTML children were block-level. This caused things like<sup>2</sup>to wrap its content in a<p>tag.So
The area is 5km<sup>2</sup>.now renders as you would expect:If you pattern match on
HtmlInline, the children change fromList BlocktoList Inline.Raw body capture on HtmlElement
HtmlElementnow includes the raw source text between the opening and closing tags as aStringfield. This lets you preserve content verbatim for tags like<style>or<script>.You can access it in a renderer with
withRawContent:If you pattern match on
HtmlElement, add the extraStringfield:Positional heuristic for inline vs block HTML
Single-line HTML tags at the start of a line now become inline when they are adjacent to paragraph text. Multi-line tags (closing tag on a different line) always become blocks.
Examples:
A blank line keeps it as a block:
Multi-line HTML always becomes a block, even if it interrupts a paragraph:
Inline HTML is single-line only. A tag that starts mid-line and spans multiple lines will not parse as an HTML element (just as the raw text of the HTML). This avoids the confusing case where adding a newline inside a tag silently breaks parsing, similar to how MDX handles this with a parser error.