-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
bugAn error in the Docusaurus core causing instability or issues with its executionAn error in the Docusaurus core causing instability or issues with its execution
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
Description
The docs say that adding format: md front matter makes the doc to be CommonMark format, but it doesn't work.
After looking into the code, it should be
---
mdx:
format: md
---It reads the mdx in front matter first
docusaurus/packages/docusaurus-mdx-loader/src/utils.ts
Lines 99 to 105 in a4fa4c2
| const mdxFrontMatter = validateMDXFrontMatter(frontMatter.mdx); | |
| const processor = await getProcessor({ | |
| filePath, | |
| options, | |
| mdxFrontMatter, | |
| }); |
docusaurus/packages/docusaurus-mdx-loader/src/processor.ts
Lines 266 to 285 in a4fa4c2
| export async function getProcessor({ | |
| filePath, | |
| mdxFrontMatter, | |
| options, | |
| }: { | |
| filePath: string; | |
| mdxFrontMatter: MDXFrontMatter; | |
| options: Options; | |
| }): Promise<SimpleProcessor> { | |
| const processors = | |
| options.processors ?? (await createProcessorsCacheEntry({options})); | |
| const format = getFormat({ | |
| filePath, | |
| frontMatterFormat: mdxFrontMatter.format, | |
| markdownConfigFormat: options.markdownConfig.format, | |
| }); | |
| return format === 'md' ? processors.mdProcessor : processors.mdxProcessor; | |
| } |
But the docs say it's format in front matter.
| - The `format: md` front matter |
| It is possible to **opt-in for CommonMark** using the [`siteConfig.markdown.format`](../../api/docusaurus.config.js.mdx#markdown) setting or the `format: md` front matter. |
Should it be fixed in the code or in the docs?
Reproducible demo
No response
Steps to reproduce
- add
format: mdfront matter in.mdxfile - nothing happened
Expected behavior
Doc changes to CommonMark syntax.
Actual behavior
Doc stay with JSX syntax
Your environment
- Public source code:
- Public site URL:
- Docusaurus version used: v3
- Environment name and version (e.g. Chrome 89, Node.js 16.4):
- Operating system and version (e.g. Ubuntu 20.04.2 LTS):
Self-service
- I'd be willing to fix this bug myself.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugAn error in the Docusaurus core causing instability or issues with its executionAn error in the Docusaurus core causing instability or issues with its execution