Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated docs to include PlantUML extension #9607

Merged
merged 3 commits into from
Jan 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added PlantUML extension documentation
  • Loading branch information
cjlotz committed Jan 12, 2024
commit 9738d3aff8ecd3dfd53cc6d88851ed12a84cc8f1
79 changes: 78 additions & 1 deletion docs/docs/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,83 @@ class Class10 {
}
```

## PlantUML Diagrams

You can embed [PlantUML](https://plantuml.com/) diagrams using markdown code blocks:

Example:

```plantuml
Bob -> Alice : hello
```

This will be rendered as:

![alt-text](https://www.plantuml.com/plantuml/svg/SoWkIImgAStDuNBAJrBGjLDmpCbCJbMmKiX8pSd9vt98pKi1IW80)

There are plenty of other diagrams supported by PlantUML such as:

* [Sequence diagram](http://plantuml.com/sequence-diagram)
* [Use Case diagram](http://plantuml.com/use-case-diagram)
* [Class diagram](http://plantuml.com/activity-diagram-beta)
* [Activity diagram](http://plantuml.com/activity-diagram-beta)
* [Component diagram](http://plantuml.com/component-diagram)
* [State diagram](http://plantuml.com/state-diagram)
* [Gantt diagram](https://plantuml.com/gantt-diagram)
* [Deployment diagram](http://plantuml.com/deployment-diagram)
* [Mindmap diagram](https://plantuml.com/mindmap-diagram)

Refer to the [PlantUml reference guide](http://plantuml.com/PlantUML_Language_Reference_Guide.pdf) for more details.

### Settings

The PlantUML extension can be configured using the `build.markdownEngineProperties.plantUml` property of your `docfx.json` file:

```json
{
"build": {
"markdownEngineProperties": {
"plantUml": {
"outputFormat": "svg",
"remoteUrl": "http://www.plantuml.com/plantuml/",
"renderingMode": "remote"
}
}
}
}
```

The following settings are available for configuration:

| Setting | Description | Default |
| ------- | ----------- | ---------|
| `javaPath` | path to java installation | uses the JAVA_HOME environment variable |
| `localGraphvizDotPath` | path to graphviz dot exe (required for local rendering mode only) | none |
| `localPlantUmlPath` | path to plantuml.jar | will look in project directory |
| `outputFormat` | format of generated images (svg, ascii, ascii_unicode) | svg |
| `remoteUrl` | url to remote PlantUml server (required for remote rendering mode only) | http://www.plantuml.com/plantuml/ |
| `renderingMode` | remote or local | remote

### Local Rendering

By default, PlantUML diagrams will be rendered on the remote server. Local rendering mode uses a [local copy](https://plantuml.com/faq-install) of PlantUML to render diagrams. Local rendering mode can be configured in your `docfx.json` file:

```json
{
"build": {
"markdownEngineProperties": {
"plantUml": {
"localPlantUmlPath": "path/to/plantuml.jar",
"renderingMode": "local"
}
}
}
}
```

> [!NOTE]
> GraphViz Dot is required for local rendering mode of any diagram other than sequence. Refer to the [PlantUML documentation](http://plantuml.com/graphviz-dot) for more detailed instructions.

## Include Markdown Files

Where markdown files need to be repeated in multiple articles, you can use an include file. The includes feature replace the reference with the contents of the included file at build time.
Expand Down Expand Up @@ -453,4 +530,4 @@ For example:
```

In GFM, it will be rendered as a paragraph with content `[!NOTE] This is code.` in blockquote.
In DFM, it will be rendered as a code in note.
In DFM, it will be rendered as a code in note.