Inject PlantUML into GitBook as an SVG element.
This is forked from wewei/gitbook-plugin-plantuml-svg.
This plugin makes 1 additional improvement, you can do some configurations in book.json
:
{
"pluginsConfig": {
"plantuml-svg": {
"serviceUrl": "http://plantuml-service-url/svg",
"config": [
"skinparam defaultFontName Microsoft YaHei",
"skinparam defaultFontSize 14"
]
}
}
}
# With NPM
$ npm install gitbook-plugin-plantuml-svg2
# With Yarn
$ yarn add gitbook-plugin-plantuml-svg2
In your book.json
, add plantuml-svg2
to the plugin list
{
"plugins": ["plantuml-svg2"]
}
Say, you have graph/my-chart.puml
.
@startuml
object Hello
object World
Hello --> World
@enduml
In your Markdown document, put following lines.
{% uml src="graph/my-chart.puml" %}
{% enduml %}
By default, the file path is relative to the project root. If you want the path to be relative to current document, do
{% uml src="graph/my-chart.puml", relativeTo=file %}
{% enduml %}
The standalone PlantUML file is recommended for large graphs. However, for simple graphs, you can also use inline plugin PlantUML.
{% uml %}
@startuml
object Hello
object World
Hello --> World
@enduml
{% enduml %}