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

Curly braces in code blocks are not escaped and raise an error #11

Open
zhouzi opened this issue Nov 8, 2022 · 3 comments
Open

Curly braces in code blocks are not escaped and raise an error #11

zhouzi opened this issue Nov 8, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@zhouzi
Copy link
Owner

zhouzi commented Nov 8, 2022

Due to Docusaurus interpreting .md files as MDX, curly braces are troublesome. They're currently escaped in description and inline code, through #10

The issue with code blocks is that the current Markdown parser (marked) escapes the content of code blocks. In the below example:

{ example }

If we turn that into:

{ example }

The parser would then turn that into:

{ example }

As a side note, this issue is tracked through facebook/docusaurus#3018 from docusaurus' side.

@zhouzi zhouzi added the bug Something isn't working label Nov 8, 2022
@Braunson
Copy link

I just ran through this issue again. I had another error url is not defined which ended up being due to this line that contains { url }

<blockquote>Deprecated: Query media { url } instead</blockquote>

And in the GraphQL Schema

"Type of content"
type Content {
    "The ID for the Content"
    id: ID!
    
    "Media for the Content"
    mediaUrl: String @rename(attribute: "media_url") @deprecated(reason: "Query media { url } instead")
}

While I can remove that from the GraphQL schema, I wonder if there's a way to escape or ignore it in Docusaurus when building or rather when building the GraphQL docs themselves (via the plugin)?

Possible solution:

  • Convert any curly braces to entities &lbrace; and &rbrace;? Though they don't render properly in markdown and just end up as text.

@zhouzi
Copy link
Owner Author

zhouzi commented Mar 24, 2023

Thanks for reporting @Braunson 👍 This one should be easy to fix as we can safely escape curly braces there. I just created #17 to look into it.

@zhouzi
Copy link
Owner Author

zhouzi commented Jun 2, 2023

Docusaurus pushed an update so Markdown files are not interpreted by MDX which solves this issue and others: facebook/docusaurus#3018 (comment)

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