2.10.0
中文
Skip to content

Custom plugin ​

You can use Marked extensions, or use an object with 'transform(content)' to rewrite the string before parsing. Customize the tag and then use the 'components' mapping.

String transform ​

plugin

Ship the TODO before Friday.

String transform

A plugin transform bolds TODO before marked runs.

Marked extension: footnotes ​

Next, use tokenizer / renderer to convert [^n] to <footnote>, then map it to a component with Popover.

XMarkdown supports custom marked extensions.1

Map the generated tag with components for interaction.2

See the plugins page for Latex / Highlight / Mermaid.3

Footnote syntax plus a components mapping.

Division of work with components ​

MethodStageFunction
config.extensions / marked pluginMarkdown → HTMLRecognize new syntax, output HTML tags
plugins[].transformBefore parsingRewrite as plain string
componentsHTML → VNodeReplace tags with Vue components

For more API details, see Code Examples · FAQ.