A Unified/Remark plugin to automatically refer PlantUML diagrams into embeddable image URLs. Transform UML code blocks into visual diagrams.
npm install remark-refer-plantuml
Input Markdown:
## Hello World
This is the PlantUML diagram.
```plantuml
@startuml
Bob -> Alice : hello
@enduml
```
Use this plugin in your code,
import {unified} from 'unified';
import remarkParse from 'remark-parse';
import remarkStringify from 'remark-stringify';
import remarkReferPlantUml from 'remark-refer-plantuml';
const processor = unified().use(remarkParse).use(remarkReferPlantUml).use(remarkStringify);
const output = await processor.process(input);
It will output,
## Hello World
This is the PlantUML diagram.

This package is ESM-only and provides a default export: remarkReferPlantUml
. You can integrate it with unified.js
, react-markdown
and so on.
Specifies the output format. Defaults to 'png'
. Only 'svg'
and 'png'
are supported.
Enables dark mode for diagrams. Default to false
.
The Plantuml server used to generate the diagram hyperlinks, you can use your deployed one. Default to the official server instance https://www.plantuml.com/plantuml if you are ok with sending data to it.
Ignore all warnings. Default to false
.
We welcome contributions! Please read our Contribution Guide before submitting PRs.