NAME

Statocles::Plugin::Diagram::Mermaid - Render diagrams using mermaid https://mermaidjs.github.io

VERSION

version 0.098

SYNOPSIS

# --- Configuration
# site.yml
---
site:
    class: Statocles::Site
    args:
        plugins:
            diagram:
                $class: Statocles::Plugin::Diagram::Mermaid

# --- Usage
<%= diagram mermaid => begin %>
sequenceDiagram
loop every day
    Alice->>John: Hello John, how are you?
    John-->>Alice: Great!
end
<% end %>

DESCRIPTION

This plugin adds the diagram helper function to all templates and content documents, allowing for creation of mermaid diagrams.

ATTRIBUTES

mermaid_url

Set the url to use as a, possibly local, alternative to the default script mermaid.min.js for including in a script tag.

METHODS

diagram

%= diagram $type => $content

Wrap the given $content with the html for displaying the diagram with mermaid.js.

In most cases displaying a diagram will require the use of begin/end:

%= diagram mermaid => begin
graph TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[Car]
% end

register

Register this plugin with the site. Called automatically.

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.