require-markdown-mermaid-when-theme-mermaid-enabled
Require markdown.mermaid to be true when @docusaurus/theme-mermaid is configured.
Targeted pattern scopeโ
This rule focuses on docusaurus.config.* files.
It reports Mermaid theme setup when:
@docusaurus/theme-mermaidis configured
but:
markdown.mermaidis missingmarkdown.mermaidis nottrue
What this rule reportsโ
This rule reports Mermaid theme configuration that does not also enable Mermaid markdown support.
Why this rule existsโ
The Docusaurus Mermaid docs require the theme and the markdown flag together.
Adding only the theme leaves Mermaid markdown features half-enabled and makes the config harder to reason about.
Mermaid relationship diagramโ
โ Incorrectโ
export default {
themes: ["@docusaurus/theme-mermaid"],
};
โ Correctโ
export default {
themes: ["@docusaurus/theme-mermaid"],
markdown: {
mermaid: true,
},
};
Behavior and migration notesโ
This rule autofixes the common literal-object cases it can rewrite safely:
- add a new top-level
markdownobject when it is missing - add
mermaid: trueto an existingmarkdownobject - replace literal
falsewithtrue
Additional examplesโ
โ Incorrect โ Mermaid explicitly disabledโ
export default {
themes: ["@docusaurus/theme-mermaid"],
markdown: {
mermaid: false,
},
};
โ Correct โ Mermaid enabledโ
export default {
themes: ["@docusaurus/theme-mermaid"],
markdown: {
mermaid: true,
},
};
ESLint flat config exampleโ
import docusaurus2 from "eslint-plugin-docusaurus-2";
export default [docusaurus2.configs.recommended];
When not to use itโ
Do not use this rule if you intentionally keep the Mermaid theme installed without enabling Mermaid markdown support and you do not want linting to normalize that config.
Rule catalog ID: R093