Skip to content

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

@Ugzuzg

Description

@Ugzuzg

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingroadmapFeatures or bug fixes planned for future release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions