fix: prevent mdx block collapsing under prettier#94
Draft
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
a6f7bde to
76dd79f
Compare
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.
Summary
This PR fixes an MDX formatting regression where Prettier collapses nested block markdown inside JSX-style components such as
<Tab>,<Step>, and<Accordion>. The collapse turns multiline tables, lists, and code fences into single-line content, which breaks readability and can break rendering for docs pages.User Impact
Authors editing docs could run formatting and unintentionally damage complex MDX sections. The issue was hard to catch in review because the resulting output is still syntactically valid MDX in many cases, but semantically degraded and difficult to read.
Root Cause
In MDX component children, indented block markdown without explicit blank-line boundaries can be interpreted in a way that Prettier rewrites as inline-ish content. This behavior is inconsistent and most visible in component-heavy docs sections.
Fix
This PR keeps Prettier and adds a targeted guardrail instead of removing formatting tooling:
<Step>,<Tab>, and<Accordion>.Files Changed
.github/workflows/prettier.yml.husky/.gitignore.husky/pre-commitREADME.mdSTYLE_GUIDE.mdpackage.jsonresources/developer/initia-l1.mdxscripts/check-mdx-jsx-block-spacing.mjsValidation
npm run format:checknpm run lint:mdx-spacing -- resources/developer/initia-l1.mdxnpm run lint:mdx-spacing -- --staged)Notes
This PR intentionally enforces the new MDX rule on changed files (staged/PR diff) to avoid blocking merge on legacy formatting debt. A full retroactive cleanup can be done in a separate follow-up PR.