@mdit/plugin-plantuml
Plugin to support plant uml base on @mdit/plugin-uml.
Usage
import { plantuml } from "@mdit/plugin-plantuml";
import MarkdownIt from "markdown-it";
const mdIt = new MarkdownIt().use(plantuml);
mdIt.render(`\
@startuml
Bob -> Alice : hello
@enduml
`);Options
"uml" | "fence""uml"Plantuml parse type.
string"uml"Diagram type. Only available when using default srcGetter.
stringFence info. Defaults to the value of name.
stringOpening marker. Only available with type "uml". Defaults to "start" + name.
stringClosing marker. Only available with type "uml". Defaults to "end" + name.
string"https://www.plantuml.com/plantuml"Plantuml server. Only available when using default srcGetter.
External requests
With the default srcGetter, the diagram source is sent to the configured PlantUML server (https://www.plantuml.com/plantuml by default), which is an external request that may leak diagram content. Self-host the server or provide a custom renderer when the diagram source is sensitive.
string"svg"Image format. Only available when using default srcGetter.
(content: string) => stringImage src getter. Takes diagram content and returns image link.
RendererRule/**
* @param tokens - List of tokens.
* @param index - Current token index.
* @param options - Markdown-it options.
* @param env - Markdown-it environment.
* @param self - Markdown-it renderer instance.
*
* @returns Rendered HTML string.
*/
type RendererRule = (
tokens: Token[],
index: number,
options: Required<MarkdownItOptions>,
env: Env | undefined,
self: Renderer,
) => string;Diagram renderer.
Demo
@startuml
Bob -> Alice : hello
@enduml@startuml
Bob -> Alice : 你好
@endumlSee the comparison report for the full upstream comparison.