Repository navigation
fix(mdxish): parse indented markdown inside plain html wrappers - #1545
Conversation
|
@coderabbitai review |
✅ Action performedReview finished.
|
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe change refines HTML-flow block termination using indentation, standalone opening-tag, and raw-content depth rules. MDXish component parsing now fully deindents deeper bodies and applies the termination helper before Markdown parsing. New fixtures and tests cover Markdown inside nested HTML wrappers, indented content, lists, links, blockquotes, tables, inline formatting, raw-content elements, and equivalent rendering through MDX and MDXish. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
__tests__/lib/mdxish/markdown-inside-indented-html.test.ts (1)
91-102: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueNit:
classvsclassNameinconsistent with the rest of this file.Every other element here uses
className; this test uses plainclass. Doesn't affect the assertions, just a style inconsistency.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@__tests__/lib/mdxish/markdown-inside-indented-html.test.ts` around lines 91 - 102, Update the HTML anchor attributes in the test case around the deeply indented wrapper to use className consistently with the other elements in the file, while preserving the existing assertions and test behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@__tests__/lib/mdxish/markdown-inside-indented-html.test.ts`:
- Around line 91-102: Update the HTML anchor attributes in the test case around
the deeply indented wrapper to use className consistently with the other
elements in the file, while preserving the existing assertions and test
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1e5fb750-a164-4372-88b9-a801a8b334df
📒 Files selected for processing (7)
__tests__/fixtures/markdown-in-html-tests.mdx__tests__/lib/mdxish/markdown-inside-indented-html.test.ts__tests__/lib/render-mdxish/markdown-in-html.test.tsx__tests__/transformers/terminate-html-flow-blocks.test.tsexample/docs.tsprocessor/transform/mdxish/components/mdx-blocks.tsprocessor/transform/mdxish/terminate-html-flow-blocks.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
readmeio/ai(manual)readmeio/gitto(manual)readmeio/markdown(manual)readmeio/readme(manual)
There was a problem hiding this comment.
Cleaned up the testing file, but did further testing & this looks good on solving the indentation issue on components! It definitely feels cleaner overall, but want to also note we're still limited by common mark's 4 indent -> code rule, so on normal docs they still get converted to code / not parsed.
E.g. this would still render different from MDX:
<div className="outer-wrapper" data-testid="nested-wrappers">
<div className="inner-wrapper">
##### Markdown After A Nested Opening Tag
</div>
</div>
But I think for these cases we need a bigger & different refactor from this! We can get this out first
a2a0861
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@__tests__/lib/mdxish/markdown-inside-indented-html.test.ts`:
- Around line 120-130: Extend the test case “does not treat deeply indented
content as code when nested under unindented HTML” to assert that the
account-balance text is preserved in the parsed AST or rendered HTML, in
addition to verifying no code element exists. Use the existing AST/query helpers
and the distinctive “Account balances” text.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d1788790-9f05-486f-9b7d-bf91a20b2d0b
📒 Files selected for processing (2)
__tests__/lib/mdxish/markdown-inside-indented-html.test.tsprocessor/transform/mdxish/components/mdx-blocks.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
readmeio/ai(manual)readmeio/gitto(manual)readmeio/markdown(manual)readmeio/readme(manual)
🚧 Files skipped from review as they are similar to previous changes (1)
- processor/transform/mdxish/components/mdx-blocks.ts
## Version 14.11.5 ### 🛠 Fixes & Updates * **mdxishTags:** capture components inside HTML blocks ([#1547](#1547)) ([06d84d5](06d84d5)) * **mdxish:** parse indented markdown inside plain html wrappers ([#1545](#1545)) ([522275a](522275a)), closes [#1344](#1344) * **mdxish:** stop escaping intraword underscores on serialization ([#1546](#1546)) ([571f839](571f839)) <!--SKIP CI-->
This PR was released!🚀 Changes included in v14.11.5 |

(See slack thread)
Markdown indented for readability right after a plain HTML opening tag (
<div>…## Heading) rendered as literal text. CommonMark HTML blocks only end at a blank line, so the content got swallowed. Same problem inside component bodies such as<Tabs>, where leftover indentation could also turn paragraphs into code blocks.🎯 What does this PR do?
terminateHtmlFlowBlocksnow also terminates 1–3 column shapes, but only after a lone opening tag followed by markdown. Column-0 behavior is unchanged, 4+ columns is still left alone (indented-code territory, fix(mdxish): tone down empty line addition preprocessing after html blocks #1344), and open<pre>/<table>payloads stay byte-exact.terminateHtmlFlowBlocksafterward, since dedenting invalidates the top-level pass's decisions.Covered by unit tests, AST tests, and a new fixture rendered through both engines to ensure mdx/mdxish parity (headings, links, lists, quotes, tables in HTML wrappers).
Surfaced along the way, not fixed here: lists/blockquotes directly after a plain HTML opener don't parse in mdxish (pre-existing tokenizer limitation) — follow-up material.
🧪 QA tips
Run locally in the dev playground. Everything should render as real markdown inside its wrapper — no literal
##/>text, no stray code blocks.Paste fixture sections into an mdxish page and the output should match.
[ ]
📸 Screenshot or Loom