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

[v2] Fails to build if markdown image alt-text has double quotes #3751

Closed
garrettjstevens opened this issue Nov 14, 2020 · 1 comment · Fixed by #3757
Closed

[v2] Fails to build if markdown image alt-text has double quotes #3751

garrettjstevens opened this issue Nov 14, 2020 · 1 comment · Fixed by #3757
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@garrettjstevens
Copy link

🐛 Bug Report

If the alt-text for an image in a markdown file has double quotes, docusaurus will not build.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. Create docusaurus page with classic template
  2. To any markdown file, add an image with double quotes in the alt text, like this:
    ![alt text with "quotes"!](../static/img/logo.svg)

Expected behavior

The page builds.

Actual Behavior

The site will not build. The error looks like:

./docs/doc1.md
SyntaxError: /sandbox/docs/doc1.md: Unexpected token, expected "}" (65:57)

> 65 | <p>{`Has quotes in alt text: `}<img alt={"alt text with "quotes"!"} src={require("!url-loader?limit=10000&name=assets/images/[name]-[hash].[ext]&fallback=file-loader!./../static/img/logo.svg").default}  /></p>
     |                                                          ^

It looks to me like the double quotes are not getting escaped.

Your Environment

  • Docusaurus version used: 2.0.0-alpha.66
  • Environment name and version: Chrome 86.0.4240.198, Node.js 10.21.0
  • Operating system and version: Linux Mint

Reproducible Demo

Reproducible codesandbox: https://codesandbox.io/s/suspicious-brattain-1g5k4?file=/docs/doc1.md:2219-2294

@garrettjstevens garrettjstevens 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 Nov 14, 2020
garrettjstevens added a commit to GMOD/jbrowse-components that referenced this issue Nov 14, 2020
garrettjstevens added a commit to GMOD/jbrowse-components that referenced this issue Nov 14, 2020
@slorber
Copy link
Collaborator

slorber commented Nov 16, 2020

Thanks, you are right, our remark plugins should escape those quotes properly

@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants