Closed darwintree closed 1 year ago
Apparently, this is a bug in MDX 1, reproducible in the MDX 1 playground: https://mdx-git-renovate-babel-monorepo-mdx.vercel.app/playground/ MDX 1 is not updated anymore.
We'll upgrade soon to MDX 2 (Docusaurus v3, breaking change) but it does not use html comments by default so you'll have to use JSX comments instead.
Closing because we can't really act on it apart upgrading to MDX 2
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Html comment in markdown files raises a syntax error if there is a trailing space. For example, the markdown code:
<!-- ![blabla.png](/img/blabla.png)-->
raises an error but<!-- ![blabla.png](/img/blabla.png)-->
doesn't.Reproducible demo
https://github.com/Conflux-Chain/conflux-documentation/tree/l10n_translation-pipeline
Steps to reproduce
The error could be reproduced by using the demo in Github codespace. You can simply run
yarn zh
. Or:Note: there is a trailing space
for the second line
Expected behavior
Actual behavior
I am integrating my project with Crowdin to the i18n. The default strategy of Crowdin would convert the trailing
\n
to a space in certain circumstances. So this is the source doc and here is an auto-generated untranslated file by Crowdin.The command
yarn start --locale zh-Hans
but the compilation fails. Although Crowdin slightly changes the structure of the original file, I think it is acceptable because other tools, like vs code, won't raise an error. As far as I am concerned, this might be a bug of docusaurus or its markdown parsing engine. (This is not the actual error, but is exactly same except for line number)Your environment
Self-service