gmunguia / markdown-it-plantuml

:herb: :book: plantuml diagrams in your markdown
MIT License
99 stars 20 forks source link

markdown-it-plantuml

npm version CircleCI build

Plugin for creating block-level uml diagrams for markdown-it markdown parser.

With this plugin you can create uml diagrams inside your markdown files:

# UML example:

@startuml
Bob -> Alice : hello
@enduml

See plantuml website for more details.

Installation

node.js, browser:

$ npm install markdown-it-plantuml --save

Basic usage

const md = require('markdown-it')()
           .use(require('markdown-it-plantuml'));

See markdown-it repository for more details.

Advanced usage

const md = require('markdown-it')()
           .use(require('markdown-it-plantuml'), options);

Options:

Example: using custom URL to serve diagrams

const options = {
  generateSource: function generateSource(umlCode) {
    return `https://your.server/plant-uml/${yourEncodeFunction(umlCode)}`;
  }
}

const md = require('markdown-it')()
           .use(require('markdown-it-plantuml'), options);

Example: generating ditaa diagrams

const options = {
  openMarker: '@startditaa',
  closeMarker: '@endditaa',
  diagramName: 'ditaa',
  imageFormat: 'png'
}

const md = require('markdown-it')()
           .use(require('markdown-it-plantuml'), options);

License

MIT