1.0.1 • Published 9 years ago
mermaid-loader v1.0.1
mermaid-loader
mermaid-loader for webpack using mermaid.
It outputs PNG images from your mermaid diagrams. Can be useful for slides made with presentation frameworks like Reveal or Spectacle
Here is a sequence diagram:
sequenceDiagram
A->> B: Query
B->> C: Forward query
Note right of C: Thinking...
C->> B: Response
B->> A: Forward responseMermaid loader outputs this png:

Installation
npm i mermaid-loader -D
Usage
var html = require("mermaid!./diagram.mmd");
// => emits diagram.png as file in the output directory and returns the public url
// => returns i. e. "/public-path/diagram.pngBy default the filename of the resulting file is the filename with .mmd extension replaced by .png extension
Filename templates
You can configure a custom filename template for your file using the query
parameter name. For instance, to copy a file from your context directory
into the output directory retaining the full directory structure, you might
use ?name=[path][name].[ext].
mermaid-loader works like file-loader. More instructions here.
Recommended Configuration
{
module: {
loaders: [
{ test: /\.mmd$/, loader: "mermaid" },
]
}
}