Repository navigation
fix(theme-classic): render CommonMark inline <code> with nested HTML elements inline (AI-assisted)
#13090
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
base: main
Are you sure you want to change the base?
fix(theme-classic): render CommonMark inline <code> with nested HTML elements inline (AI-assisted)
#13090
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| This content comes from a CommonMark (`.md`) partial, where raw HTML `<code>` elements are rendered with the `MDXComponents/Code` component. | ||
|
|
||
| Inline code with elements stays inline: <code>git clone <var>repository</var></code>, <code>x <b>y</b> z</code> and <code><em>emphasis</em></code>. | ||
|
|
||
| Inline code with a string stays inline: <code>inline text</code>. | ||
|
|
||
| Multi-line code with elements renders as a code block: | ||
|
|
||
| <code> | ||
| <a href="/">Front page</a> | ||
| <br /> | ||
| <strong>Input: </strong>a = "abcd" | ||
| </code> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,6 +147,12 @@ Multi-line text inside `pre` will turn into one-liner, but it's okay (https://gi | |
| <br /> | ||
| </code> | ||
|
|
||
| ### `code` in CommonMark | ||
|
|
||
| import CodeCommonMark from './_code-md.md'; | ||
|
|
||
| <CodeCommonMark /> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Place the CommonMark fixture on a page that Argos screenshots.
Move the CommonMark section to a
|
||
|
|
||
| ## `CodeBlock` | ||
|
|
||
| ### `CodeBlock > string` | ||
|
|
||
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.
Keep single-line code with mapped HTML children inline, or document the exclusion.
Under
format: 'md', raw inline HTML becomes element nodes, and MDX renders each one through the component map. The authored<a>therefore reachesisHtmlElementas theMDXAfunction, not as the string'a'.isHtmlElementrejects it, so<code>x <a href="/">y</a></code>on one line still renders as aCodeBlock.<var>stays inline because it has no mapping.Decide whether "intrinsic HTML elements" in this change includes elements that the component map replaces. If it does, the single-line check must accept those element types and still recurse into their children. If it does not, document that mapped elements keep the block fallback.