Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ugzuzg opened this issue Jul 8, 2024 · 2 comments
Open

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

Ugzuzg opened this issue Jul 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Ugzuzg
Copy link
Contributor

Ugzuzg commented Jul 8, 2024

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:
@Ugzuzg Ugzuzg added the bug Something isn't working label Jul 8, 2024
@sserrata
Copy link
Member

sserrata commented Jul 8, 2024

Hi @Ugzuzg, thanks for reporting the issue. The fix seems straightforward but can you provide steps to reproduce so I can be certain I'm addressing your issue? Are you defining these code blocks/fences in normal doc files or embedding them inside your OpenAPI spec summary/description?

@Ugzuzg
Copy link
Contributor Author

Ugzuzg commented Jul 9, 2024

@sserrata, edited the description with more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants