Skip to content

format: md front matter doesn't work #10628

@doraeric

Description

@doraeric

Have you read the Contributing Guidelines on issues?

Prerequisites

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

const mdxFrontMatter = validateMDXFrontMatter(frontMatter.mdx);
const processor = await getProcessor({
filePath,
options,
mdxFrontMatter,
});

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.


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

  1. add format: md front matter in .mdx file
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions