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

ReferenceError when Markdown file contains HTML with curly braces #4288

Closed
zhouzi opened this issue Feb 24, 2021 · 3 comments
Closed

ReferenceError when Markdown file contains HTML with curly braces #4288

zhouzi opened this issue Feb 24, 2021 · 3 comments
Labels
closed: working as intended This issue is intended behavior, there's no need to take any action. external This issue is caused by an external dependency and not Docusaurus.

Comments

@zhouzi
Copy link

zhouzi commented Feb 24, 2021

🐛 Bug Report

I have automatically generated Markdown files (.md) that contain HTML. The page crashes if that HTML contains a pair of curly braces:

<p>This {html} code is in a .md file.</p>

Results in: ReferenceError: html is not defined

Have you read the Contributing Guidelines on issues?

Yes.

To Reproduce

  1. https://codesandbox.io/s/reverent-lederberg-f8jcl
  2. Access the first page.
  3. An error is thrown: ReferenceError: page is not defined

Expected behavior

I was expecting to be able to access the page and read my content.

Actual Behavior

Instead the page crashed with an error message.

Capture d’écran 2021-02-24 à 17 25 06

Your Environment

Reproducible Demo

https://codesandbox.io/s/reverent-lederberg-f8jcl

If you want to reproduce it on your own, here's how you can do it:

  1. Create a new docusaurus project.
  2. Edit a Markdown file and add HTML in it with something wrapped with curly braces, for example: <p>Hey {there}!</p>
  3. Start the application and try accessing the page you edited.

Although I like the idea that Docusaurus is able to infer some nice defaults, it seems that Markdown has some incompatibilities with MDX. So perhaps it should not be parsed as MDX if the file extension is .md?

@zhouzi zhouzi added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Feb 24, 2021
@zhouzi
Copy link
Author

zhouzi commented Feb 24, 2021

I just stumbled upon the feature request and RFC. Feel free to close this issue if you think it's a duplicate.

@zhouzi zhouzi closed this as completed Feb 24, 2021
@Josh-Cena Josh-Cena added external This issue is caused by an external dependency and not Docusaurus. closed: working as intended This issue is intended behavior, there's no need to take any action. and removed bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Mar 6, 2022
@SebastienGllmt
Copy link

I don't think this was fixed by #3018 since even if I specify format: 'md' in my front matter I still get Could not parse expression with acorn (caused by the unescaped { in the markdown file)

@slorber
Copy link
Collaborator

slorber commented Jan 8, 2024

@SebastienGllmt if something does not work please open a new issue and provide a docusaurus.new runnable repro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: working as intended This issue is intended behavior, there's no need to take any action. external This issue is caused by an external dependency and not Docusaurus.
Projects
None yet
Development

No branches or pull requests

4 participants