@mdit/plugin-plantuml
Plugin to support plant uml base on @mdit/plugin-uml.
Usage
import MarkdownIt from "markdown-it";
import { plantuml } from "@mdit/plugin-plantuml";
const mdIt = MarkdownIt().use(plantuml);
mdIt.render(`\
@startuml
Bob -> Alice : hello
@enduml
`);Demo
demo
@startuml
Bob -> Alice : hello
@endumlNon-ascii demo
@startuml
Bob -> Alice : 你好
@endumlOptions
type
- Type:
"uml" | "fence" - Default:
"uml" - Details: Plantuml parse type.
name
- Type:
string - Default:
"uml" - Details: Diagram type. Only available when using default srcGetter.
fence
- Type:
string - Details: Fence info. Defaults to the value of
name.
open
- Type:
string - Details: Opening marker. Only available with type "uml". Defaults to
"start" + name.
close
- Type:
string - Details: Closing marker. Only available with type "uml". Defaults to
"end" + name.
server
- Type:
string - Default:
"https://www.plantuml.com/plantuml" - Details: Plantuml server. Only available when using default srcGetter.
format
- Type:
string - Default:
"svg" - Details: Image format. Only available when using default srcGetter.
srcGetter
- Type:
(content: string) => string - Details: Image src getter. Takes diagram content and returns image link.
render
- Type:
RenderRule
/**
* @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 RenderRule = (
tokens: Token[],
index: number,
options: Options,
env: Env,
self: Renderer,
) => string;- Details: Diagram renderer.