Skip to content

fix(markdown): preserve tilde-fenced code blocks - #1607

Open
fly1d wants to merge 1 commit into
PaloAltoNetworks:mainfrom
fly1d:codex/preserve-tilde-code-fences
Open

fix(markdown): preserve tilde-fenced code blocks#1607
fly1d wants to merge 1 commit into
PaloAltoNetworks:mainfrom
fly1d:codex/preserve-tilde-code-fences

Conversation

@fly1d

@fly1d fly1d commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • recognize triple-tilde fenced code blocks during Markdown cleanup
  • sanitize only the non-code segments so prose surrounding either fence style is still escaped
  • add regression coverage for prose, inline code, backtick fences, and tilde fences

Fixes #883.

Verification

  • yarn test --runInBand (121 tests and 35 snapshots passed)
  • yarn build-packages
  • yarn eslint packages/docusaurus-plugin-openapi-docs/src/markdown/utils.ts packages/docusaurus-plugin-openapi-docs/src/markdown/utils.test.ts
  • yarn prettier packages/docusaurus-plugin-openapi-docs/src/markdown/utils.ts packages/docusaurus-plugin-openapi-docs/src/markdown/utils.test.ts --check

Baseline checks

  • yarn lint reaches six pre-existing errors in untouched theme files; the edited files pass ESLint directly.
  • yarn format reports six pre-existing unformatted files outside this change; the edited files pass Prettier directly.

Assistance disclosure

Implemented with OpenAI Codex (GPT-5) acting as a coding agent. The change and tests were reviewed and verified locally before submission.

Treat triple-tilde fences as code during MDX sanitization so braces and comparison operators remain unchanged.

Fixes PaloAltoNetworks#883.

Implemented by OpenAI Codex (GPT-5) acting as a coding agent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fenced code blocks started with ~~~ are incorrectly cleaned in v3

1 participant