PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs

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

Open
#883 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug roadmap
Dominant language
TypeScript
Stars
1.1k
Forks
315
Avg merge
7d 5h
Merged PRs (30d)
7

Description

Describe the bug

Markdown supports initiating fenced code blocks with ~~~, https://www.markdownguide.org/extended-syntax/#fenced-code-blocks, but it is incorrectly cleaned.

Expected behavior

~~~
{
}
~~~

Current behavior

~~~
\{
\}
~~~

Possible solution

Modify the cleaning regexp: https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/blob/main/packages/docusaurus-plugin-openapi-docs/src/markdown/utils.ts#L65

Steps to reproduce

  1. Add a code block using ~~~ to the description of a field in OpenAPI specification containing a JSON object.
  2. Generate markdown from OpenAPI specification with docusaurus gen-api-docs all.
  3. See curly braces prefixed with the backslash in the generated files.

Screenshots

Code block initiated with ~~~:
Image

Code block initiated with ``` works as expected:
Image

Context

Your Environment

  • Version used: 3.0.1
  • Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3): node.js 20
  • Operating System and version (desktop or mobile): desktop
  • Link to your project:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/docusaurus-plugin-openapi-docs/src/markdown/utils.ts at the cleaning regexp referenced in the issue. Reproduce with an OpenAPI field description containing a JSON object in a ~~~ fenced block, then run docusaurus gen-api-docs all and inspect the generated markdown. Done means the braces remain unescaped for ~~~ fences while existing triple-backtick behavior continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.