Utility
Utility options are used for general configuration and utility purposes.
formatWithPrettier
Accepts a boolean value. Defaults to
false.
This plugin generates well-formatted Markdown, however, integrating the popular formatting package Prettier can provide additional enhancements, such as:
- Formats code inside fenced blocks within comments blocks, using the respective Prettier configuration for that language.
- Aligns markdown table cells.
- Removes unnecessary escape characters.
- Wraps long lines of text to fit within a configurable line width.
Please note that Prettier is not a dependency of this plugin and must be installed if you want to use this option.
npm install prettier --save-dev{
"formatWithPrettier": false
}prettierConfigFile
Accepts a string value. Defaults to
"undefined".
By default Prettier uses the options resolved from a discovered Prettier configuration file .
Use this option to specify a separate Prettier configuration file in a custom location.
Please note this option is only applicable when formatWithPrettier is set to true.
{
"prettierConfigFile": "./path/to/.prettierrc.json"
}publicPath
Accepts a string value. Defaults to
"undefined".
If undefined all urls will be relative.
{
"publicPath": "http://abc.com"
}useHTMLEncodedBrackets
Accepts a boolean value. Defaults to
false.
By default, opening and closing angle brackets (< and >) are escaped using backslashes, and most modern Markdown processors handle them consistently.
However, using HTML entities (< and >) might be preferable to avoid any inconsistencies with some Markdown processors.
{
"useHTMLEncodedBrackets": false
}useCustomAnchors
{#custom-id} to headings.Accepts a boolean value. Defaults to
false.
Controls whether HTML custom heading IDs ({#custom-id}) are added to headings.
This syntax is not included in standard Markdown specifications such as GFM or CommonMark . You may need to configure your Markdown parser to enable this feature.
Support for custom heading IDs in popular tools:
- Docusaurus - native support
- Vitepress - native support
- Remark - requires additional plugin like remark-custom-heading-id
- Rehype - requires additional plugin like rehype-slug-custom-id
{
"useCustomAnchors": false
}customAnchorsFormat
Accepts one of
"curlyBrace"|"escapedCurlyBrace"|"squareBracket". Defaults to"curlyBrace".
This option specifies the output format for custom anchors. This is only
applicable when useCustomAnchors is set to true.
The following formats are supported:
curlyBrace-{#custom-id}This is the default format.escapedCurlyBrace-\{#custom-id\}Use this if you want to parse the output with a MDX parser. The{#custom-id}notation does not work in MDX files because MDX treats{}as JSX syntax, causing a parsing error.squareBracket-[#custom-id]Use this if you want to use with nextra .
{
"customAnchorsFormat": "curlyBrace"
}useHTMLAnchors
Accepts a boolean value. Defaults to
false.
Controls whether HTML anchors (<a id="...">) are added to headings.
Markdown processors usually auto-generate anchor IDs for headings found in a document. This plugin attempts to generate cross-links to symbols based on these IDs.
Enable this option if:
- Your Markdown parser does not generate heading IDs, making it impossible to link to headings in the document.
- The plugin cannot reliably resolve auto-generated IDs — for example, if additional headings are added dynamically.
In this case, use this option together with
anchorPrefixto ensure unique and predictable anchors.
Note: HTML anchors will always be added to linkable symbols listed in table rows, as there is no alternative way to link to these items.
{
"useHTMLAnchors": false
}anchorPrefix
Accepts a string value. Defaults to
"undefined".
Prefix to prepend to all generated anchor links.
Use this option when:
- Your Markdown parser automatically assigns a custom anchor prefix.
- You are using
useHTMLAnchorsand want to avoid ID conflicts with other elements in the document.
{
"anchorPrefix": "api-"
}sanitizeComments
Accepts a boolean value. Defaults to
false.
Please note this options does not affect the rendering of inline code or code blocks (using single/triple backticks).
By default all comments written inside JsDoc comments will be passed to the output as written, and parsers will interpret un-escaped angle brackets as HTML/JSX tags..
This option will escape angle brackets < > and curly braces { } written inside JsDoc comments.
This option would typically be used when source code comes from an external source exposing the following potential issues:
- Comments contain raw tags that should be interpreted as code examples.
- Comments contain invalid syntax that (in the case of MDX) will cause breaking parsing errors.
- Although most parsers use XSS filters, this option provides an additional layer of XSS security.
{
"sanitizeComments": false
}navigationJson
Specifies the file path where the navigation JSON will be written.
Accepts a string value.
Writes the project’s navigation structure to a JSON file on disk.
This can be parsed later to generate a sitemap or sidebar.
Use the pretty option flag to pretty-format the JSON output.
You can further configure the structure itself using the navigation output option.
Note the path is resolved according to the config directory.
{
"navigationJson": "./path/to/navigation.json"
}