Skip to content

feat: extend prettier plugin to preserve <Steps /> component#29819

Draft
mvvmm wants to merge 1 commit intoproductionfrom
mdx-steps-formatting
Draft

feat: extend prettier plugin to preserve <Steps /> component#29819
mvvmm wants to merge 1 commit intoproductionfrom
mdx-steps-formatting

Conversation

@mvvmm
Copy link
Copy Markdown
Contributor

@mvvmm mvvmm commented Apr 13, 2026

Summary

Extends the custom prettier plugin (from #29770) to also handle <Steps> blocks, and renames it from prettier-plugin-mdx-inline to prettier-plugin-cloudflare-docs since it now covers more than inline elements.

New capability — mdxPreserveElements: Prettier's MDX formatter destroys markdown list structure inside JSX block elements like <Steps> — it collapses numbered lists into a single paragraph and strips indentation from nested JSX children like <DashButton>. The plugin now supports a mdxPreserveElements option that makes prettier ignore configured components completely, preserving their content verbatim. This works by replacing matched regions with same-length HTML comment placeholders before parsing (so AST positions stay valid), then restoring the original content in the AST before the printer outputs it.

Renamed plugin: prettier-plugin-mdx-inlineprettier-plugin-cloudflare-docs, parser mdx-inlinemdx-cloudflare-docs. This is the repo's general-purpose prettier customization plugin.

Removed 18 prettier-ignore comments from 12 files that were guarding <Steps> blocks — the plugin now handles this automatically.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
* @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/ai-crawl-control/ @oxyjun, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/bots/ @patriciasantaana, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/ddos-protection/ @patriciasantaana, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/turnstile/ @migueldemoura, @punkeel, @patriciasantaana, @cloudflare/pcx-technical-writing, @cloudflare/product-owners

@github-actions
Copy link
Copy Markdown
Contributor

Preview URL: https://7dcf84e9.preview.developers.cloudflare.com
Preview Branch URL: https://mdx-steps-formatting.preview.developers.cloudflare.com

Files with changes (up to 15)

Original Link Updated Link
https://developers.cloudflare.com/bots/reference/bot-verification/web-bot-auth/ https://mdx-steps-formatting.preview.developers.cloudflare.com/bots/reference/bot-verification/web-bot-auth/
https://developers.cloudflare.com/turnstile/tutorials/login-pages/ https://mdx-steps-formatting.preview.developers.cloudflare.com/turnstile/tutorials/login-pages/
https://developers.cloudflare.com/ddos-protection/managed-rulesets/http/http-overrides/configure-dashboard/ https://mdx-steps-formatting.preview.developers.cloudflare.com/ddos-protection/managed-rulesets/http/http-overrides/configure-dashboard/
https://developers.cloudflare.com/ddos-protection/advanced-ddos-systems/how-to/create-rule/ https://mdx-steps-formatting.preview.developers.cloudflare.com/ddos-protection/advanced-ddos-systems/how-to/create-rule/
https://developers.cloudflare.com/ai-crawl-control/get-started/ https://mdx-steps-formatting.preview.developers.cloudflare.com/ai-crawl-control/get-started/
https://developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-ai-owner/connect-to-stripe/ https://mdx-steps-formatting.preview.developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-ai-owner/connect-to-stripe/
https://developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-site-owner/select-crawlers-to-charge/ https://mdx-steps-formatting.preview.developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-site-owner/select-crawlers-to-charge/
https://developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-ai-owner/verify-ai-crawler/ https://mdx-steps-formatting.preview.developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-ai-owner/verify-ai-crawler/
https://developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-site-owner/enable-in-account-settings/ https://mdx-steps-formatting.preview.developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-site-owner/enable-in-account-settings/
https://developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-site-owner/manage-payouts/ https://mdx-steps-formatting.preview.developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-site-owner/manage-payouts/
https://developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-site-owner/monitor-activity/ https://mdx-steps-formatting.preview.developers.cloudflare.com/ai-crawl-control/features/pay-per-crawl/use-pay-per-crawl-as-site-owner/monitor-activity/
https://developers.cloudflare.com/ddos-protection/advanced-ddos-systems/how-to/create-filter/ https://mdx-steps-formatting.preview.developers.cloudflare.com/ddos-protection/advanced-ddos-systems/how-to/create-filter/

@mvvmm mvvmm changed the title feat: extend prettier plugin to preserve Steps blocks and rename to cloudflare-docs feat: extend prettier plugin to preserve <Steps /> component Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants