Skip to content

feat: extend prettier plugin to preserve more mdx components#29819

Open
mvvmm wants to merge 10 commits intoproductionfrom
mdx-steps-formatting
Open

feat: extend prettier plugin to preserve more mdx components#29819
mvvmm wants to merge 10 commits 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. Renamed from prettier-plugin-mdx-inline to prettier-plugin-cloudflare-docs.

The plugin now uses a single mdxPreserveElements option (replacing the previous mdxInlineElements / mdxPreserveElements split). Elements in this list are ignored by prettier completely — their content is output verbatim regardless of length or nesting.

Expanded the protected element list to include Tabs, TabItem, FileTree, and moved code and GlossaryTooltip into it. This means code and GlossaryTooltip are now protected everywhere, including when nested inside raw HTML blocks like <div> and <table> where the previous approach had no effect.

Removed prettier-ignore comments and formatted 60+ files covering <Steps>, <Tabs>, <TabItem>, <FileTree>, <code>, and <GlossaryTooltip> — the plugin handles all of these automatically now.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

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/changelog/ @cloudflare/pm-changelogs, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/agents/ @irvinebroque, @rita3ko, @elithrar, @thomasgauvin, @threepointone, @whoiskatrin, @cloudflare/pcx-technical-writing, @cloudflare/product-owners, @cloudflare/ai-agents, @cloudflare/dev-plat-leads
/src/content/docs/ai-crawl-control/ @oxyjun, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/api-shield/ @patriciasantaana, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/bots/ @patriciasantaana, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/client-side-security/ @pedrosousa, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/cloudflare-one/traffic-policies/ @Maddy-Cloudflare, @codyanthony850@cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/ddos-protection/ @patriciasantaana, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/firewall/ @pedrosousa, @cloudflare/firewall, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/rules/ @pedrosousa, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/ruleset-engine/ @pedrosousa, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/turnstile/ @migueldemoura, @punkeel, @patriciasantaana, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/waf/ @pedrosousa, @cloudflare/firewall, @cloudflare/pcx-technical-writing, @cloudflare/product-owners
/src/content/docs/workers/ci-cd/ @irvinebroque, @aninibread, @GregBrimble, @cloudflare/pcx-technical-writing, @cloudflare/product-owners, @yomna-shousha
/src/content/docs/workers/ @cloudflare/workers-docs, @GregBrimble, @irvinebroque, @mikenomitch, @korinne, @WalshyDev, @cloudflare/deploy-config, @cloudflare/pcx-technical-writing, @cloudflare/product-owners, @cloudflare/wrangler, @mattietk, @cloudflare/dev-plat-leads
/src/content/partials/workers/ @cloudflare/workers-docs, @GregBrimble, @irvinebroque, @mikenomitch, @WalshyDev, @cloudflare/deploy-config, @cloudflare/pcx-technical-writing, @cloudflare/product-owners, @cloudflare/wrangler, @mattietk

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

Preview URL: https://6fb79daa.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/client-side-security/detection/monitor-connections-scripts/ https://mdx-steps-formatting.preview.developers.cloudflare.com/client-side-security/detection/monitor-connections-scripts/
https://developers.cloudflare.com/ddos-protection/managed-rulesets/http/http-overrides/override-examples/ https://mdx-steps-formatting.preview.developers.cloudflare.com/ddos-protection/managed-rulesets/http/http-overrides/override-examples/
https://developers.cloudflare.com/client-side-security/detection/review-malicious-scripts/ https://mdx-steps-formatting.preview.developers.cloudflare.com/client-side-security/detection/review-malicious-scripts/
https://developers.cloudflare.com/bots/get-started/super-bot-fight-mode/ https://mdx-steps-formatting.preview.developers.cloudflare.com/bots/get-started/super-bot-fight-mode/
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/rules/url-forwarding/bulk-redirects/create-dashboard/ https://mdx-steps-formatting.preview.developers.cloudflare.com/rules/url-forwarding/bulk-redirects/create-dashboard/
https://developers.cloudflare.com/client-side-security/get-started/ https://mdx-steps-formatting.preview.developers.cloudflare.com/client-side-security/get-started/
https://developers.cloudflare.com/waf/managed-rules/payload-logging/view/ https://mdx-steps-formatting.preview.developers.cloudflare.com/waf/managed-rules/payload-logging/view/
https://developers.cloudflare.com/bots/additional-configurations/detection-ids/scraping-detections/ https://mdx-steps-formatting.preview.developers.cloudflare.com/bots/additional-configurations/detection-ids/scraping-detections/
https://developers.cloudflare.com/api-shield/security/schema-validation/ https://mdx-steps-formatting.preview.developers.cloudflare.com/api-shield/security/schema-validation/
https://developers.cloudflare.com/client-side-security/detection/review-changed-scripts/ https://mdx-steps-formatting.preview.developers.cloudflare.com/client-side-security/detection/review-changed-scripts/
https://developers.cloudflare.com/client-side-security/best-practices/handle-an-alert/ https://mdx-steps-formatting.preview.developers.cloudflare.com/client-side-security/best-practices/handle-an-alert/
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/workers/ci-cd/builds/advanced-setups/ https://mdx-steps-formatting.preview.developers.cloudflare.com/workers/ci-cd/builds/advanced-setups/
https://developers.cloudflare.com/agents/api-reference/configuration/ https://mdx-steps-formatting.preview.developers.cloudflare.com/agents/api-reference/configuration/

@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
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 15, 2026

This PR requires additional review attention because it affects the following areas:

Partials

This PR updates partial files, which are pieces of content used across multiple files in our Render component.

@mvvmm mvvmm changed the title feat: extend prettier plugin to preserve <Steps /> component feat: extend prettier plugin to preserve more mdx components Apr 15, 2026
@mvvmm
Copy link
Copy Markdown
Contributor Author

mvvmm commented Apr 15, 2026

/bonk please review

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Apr 15, 2026

All validation checks pass. The PR is well-structured and implements the changes correctly:

Summary of changes:

  1. Plugin renamed from prettier-plugin-mdx-inline to prettier-plugin-cloudflare-docs
  2. Simplified configuration - single mdxPreserveElements option replacing the previous split approach
  3. Expanded protected elements - now includes Steps, Tabs, TabItem, FileTree alongside code and GlossaryTooltip
  4. Removed 100+ {/* prettier-ignore */} comments - the plugin now ignores problem-prone components by default
  5. Reformatted 60+ MDX files with consistent indentation

Plugin implementation - The new approach uses HTML comment placeholders to preserve element content verbatim, which correctly handles:

  • Nested elements (e.g., <Steps> inside <Tabs>)
  • Protected elements inside raw HTML blocks (e.g., <code> inside <table>)
  • Maintains proper byte offsets for AST nodes

Validation results:

  • Type checking: 0 errors
  • ESLint: Passed
  • Prettier format check: Passed
  • Plugin tests: Preserves all protected elements correctly

No issues found. The PR is ready for merge.

github run

@mvvmm mvvmm force-pushed the mdx-steps-formatting branch from 09daa6c to a46ce8a Compare April 15, 2026 06:16
@mvvmm mvvmm marked this pull request as ready for review April 15, 2026 14:29
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

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.

6 participants