mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-14 16:52:39 +02:00
docs: document siteConfig.markdown + better mdx-loader retrocompat (#8419)
This commit is contained in:
parent
681e6d3ea4
commit
59fac0b1d1
3 changed files with 38 additions and 1 deletions
|
@ -44,3 +44,16 @@ Array of remark plugins to manipulate the MDXAST
|
||||||
### `metadataPath`
|
### `metadataPath`
|
||||||
|
|
||||||
A function to provide the metadataPath depending on current loaded MDX path that will be exported as the MDX metadata.
|
A function to provide the metadataPath depending on current loaded MDX path that will be exported as the MDX metadata.
|
||||||
|
|
||||||
|
### `markdownConfig`
|
||||||
|
|
||||||
|
The global Docusaurus Markdown config (`config.markdown`), that plugin authors should forward:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const loader = {
|
||||||
|
loader: require.resolve('@docusaurus/mdx-loader'),
|
||||||
|
options: {
|
||||||
|
markdownConfig: siteConfig.markdown,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
|
@ -173,7 +173,7 @@ export async function mdxLoader(
|
||||||
...(reqOptions.beforeDefaultRemarkPlugins ?? []),
|
...(reqOptions.beforeDefaultRemarkPlugins ?? []),
|
||||||
...getAdmonitionsPlugins(reqOptions.admonitions ?? false),
|
...getAdmonitionsPlugins(reqOptions.admonitions ?? false),
|
||||||
...DEFAULT_OPTIONS.remarkPlugins,
|
...DEFAULT_OPTIONS.remarkPlugins,
|
||||||
...(reqOptions.markdownConfig.mermaid ? [mermaid] : []),
|
...(reqOptions.markdownConfig?.mermaid ? [mermaid] : []),
|
||||||
[
|
[
|
||||||
transformImage,
|
transformImage,
|
||||||
{
|
{
|
||||||
|
|
|
@ -394,6 +394,30 @@ module.exports = {
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `markdown` {#markdown}
|
||||||
|
|
||||||
|
The global Docusaurus Markdown config.
|
||||||
|
|
||||||
|
- Type: `MarkdownConfig`
|
||||||
|
|
||||||
|
```ts
|
||||||
|
type MarkdownConfig = {
|
||||||
|
mermaid: boolean;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```js title="docusaurus.config.js"
|
||||||
|
module.exports = {
|
||||||
|
markdown: {
|
||||||
|
mermaid: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
- `mermaid`: when `true`, allows Docusaurus to render Markdown code blocks with `mermaid` language as Mermaid diagrams.
|
||||||
|
|
||||||
### `customFields` {#customFields}
|
### `customFields` {#customFields}
|
||||||
|
|
||||||
Docusaurus guards `docusaurus.config.js` from unknown fields. To add a custom field, define it on `customFields`.
|
Docusaurus guards `docusaurus.config.js` from unknown fields. To add a custom field, define it on `customFields`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue