hugo-theme-relearn/shortcodes/mermaid/index.print.html
2022-11-17 21:13:11 +00:00

354 lines
31 KiB
HTML

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0">
<meta name="generator" content="Hugo 0.105.0">
<meta name="generator" content="Relearn 5.5.3+tip">
<meta name="description" content="Generate diagrams and flowcharts from text">
<meta name="author" content="Sören Weber">
<title>Mermaid :: Hugo Relearn Theme</title>
<link href="https://McShelby.github.io/hugo-theme-relearn/shortcodes/mermaid/index.html" rel="canonical" type="text/html" title="Mermaid :: Hugo Relearn Theme">
<link href="../../shortcodes/mermaid/index.xml" rel="alternate" type="application/rss+xml" title="Mermaid :: Hugo Relearn Theme">
<link href="../../images/logo.svg?1668719584" rel="icon" type="image/svg+xml">
<!-- https://github.com/filamentgroup/loadCSS/blob/master/README.md#how-to-use -->
<link href="../../css/fontawesome-all.min.css?1668719585" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="../../css/fontawesome-all.min.css?1668719585" rel="stylesheet"></noscript>
<link href="../../css/featherlight.min.css?1668719585" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="../../css/featherlight.min.css?1668719585" rel="stylesheet"></noscript>
<link href="../../css/auto-complete.css?1668719585" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="../../css/auto-complete.css?1668719585" rel="stylesheet"></noscript>
<link href="../../css/perfect-scrollbar.min.css?1668719585" rel="stylesheet">
<link href="../../css/nucleus.css?1668719585" rel="stylesheet">
<link href="../../css/fonts.css?1668719585" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="../../css/fonts.css?1668719585" rel="stylesheet"></noscript>
<link href="../../css/theme.css?1668719585" rel="stylesheet">
<link href="../../css/theme-relearn-light.css?1668719585" rel="stylesheet" id="variant-style">
<link href="../../css/ie.css?1668719585" rel="stylesheet">
<link href="../../css/variant.css?1668719585" rel="stylesheet">
<link href="../../css/print.css?1668719585" rel="stylesheet" media="print">
<link href="../../css/format-print.css?1668719585" rel="stylesheet">
<script src="../../js/variant.js?1668719585"></script>
<script>
// hack to let hugo tell us how to get to the root when using relativeURLs, it needs to be called *url= for it to do its magic:
// https://github.com/gohugoio/hugo/blob/145b3fcce35fbac25c7033c91c1b7ae6d1179da8/transform/urlreplacers/absurlreplacer.go#L72
window.index_js_url="../../index.search.js";
var root_url="../../";
var baseUri=root_url.replace(/\/$/, '');
// translations
window.T_Copy_to_clipboard = 'Copy to clipboard';
window.T_Copied_to_clipboard = 'Copied to clipboard!';
window.T_Copy_link_to_clipboard = 'Copy link to clipboard';
window.T_Link_copied_to_clipboard = 'Copied link to clipboard!';
window.T_No_results_found = 'No results found for \u0022{0}\u0022';
window.T_N_results_found = '{1} results found for \u0022{0}\u0022';
// some further base stuff
var baseUriFull='https:\/\/McShelby.github.io\/hugo-theme-relearn/';
window.variants && variants.init( [ 'relearn-light', 'relearn-dark', 'learn', 'neon', 'blue', 'green', 'red' ] );
</script>
<script src="../../js/jquery.min.js?1668719585" defer></script>
</head>
<body class="mobile-support print disableInlineCopyToClipboard" data-url="../../shortcodes/mermaid/index.html">
<div id="body" class="default-animation">
<div id="sidebar-overlay"></div>
<div id="toc-overlay"></div>
<nav id="topbar" class="highlightable" dir="ltr">
<div>
<div id="breadcrumbs">
<span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" title='Menu (CTRL+ALT+n)'><i class="fas fa-bars fa-fw"></i></a>
</span>
<ol class="links" itemscope itemtype="http://schema.org/BreadcrumbList">
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement"><a itemprop="item" href="../../index.html"><span itemprop="name">Hugo Relearn Theme</span></a><meta itemprop="position" content="1"> > </li>
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement"><a itemprop="item" href="../../shortcodes/index.html"><span itemprop="name">Shortcodes</span></a><meta itemprop="position" content="2"> > </li>
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement"><span itemprop="name">Mermaid</span><meta itemprop="position" content="3"></li>
</ol>
</div>
</div>
</nav>
<main id="body-inner" class="highlightable default" tabindex="-1">
<div class="flex-block-wrapper">
<div id="head-tags">
</div>
<article class="default">
<h1 id="mermaid">Mermaid</h1>
<p>The <code>mermaid</code> shortcode generates diagrams and flowcharts from text, in a similar manner as Markdown using the <a href="https://mermaidjs.github.io/">Mermaid</a> library.</p>
<div class="mermaid align-center">
graph LR;
If --&gt; Then
Then --&gt; Else
</div>
<div class="box notices cstyle note">
<div class="box-label"><i class="fa-fw fas fa-exclamation-circle"></i> Note</div>
<div class="box-content">
<p>This only works in modern browsers.</p>
</div>
</div>
<div class="box notices cstyle warning">
<div class="box-label"><i class="fa-fw fas fa-exclamation-triangle"></i> Warning</div>
<div class="box-content">
<p>Due to limitations with <a href="https://github.com/mermaid-js/mermaid/issues/1846">Mermaid</a>, it is currently not possible to use Mermaid code fences in an initially collapsed <code>expand</code> shortcode. This is a know issue and <a href="https://github.com/McShelby/hugo-theme-relearn/issues/187">can&rsquo;t be fixed by this theme</a>.</p>
</div>
</div>
<h2 id="usage">Usage</h2>
<p>While the examples are using shortcodes with named parameter it is recommended to use codefences instead. This is because more and more other software supports Mermaid codefences (eg. GitHub) and so your markdown becomes more portable.</p>
<p>You are free to also call this shortcode from your own partials.</p>
<div class="box notices cstyle note">
<div class="box-label"><i class="fa-fw fas fa-exclamation-circle"></i> Note</div>
<div class="box-content">
<p>To use codefence syntax you have to turn off <code>guessSyntax</code> for the <code>markup.highlight</code> setting (<a href="#configuration">see the configuration section</a>).</p>
</div>
</div>
<div class="tab-panel">
<div class="tab-nav">
<button
data-tab-item="codefence"
data-tab-group="shortcode-parameter"
class="tab-nav-button direction-ltr active"
onclick="switchTab('shortcode-parameter','codefence')"
><span>codefence</span></button>
<button
data-tab-item="shortcode"
data-tab-group="shortcode-parameter"
class="tab-nav-button direction-ltr "
onclick="switchTab('shortcode-parameter','shortcode')"
><span>shortcode</span></button>
<button
data-tab-item="partial"
data-tab-group="shortcode-parameter"
class="tab-nav-button direction-ltr "
onclick="switchTab('shortcode-parameter','partial')"
><span>partial</span></button>
</div>
<div class="tab-content">
<div data-tab-item="codefence" data-tab-group="shortcode-parameter" class="tab-item active">
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-md" data-lang="md"><span class="line"><span class="cl">```mermaid { align=&#34;center&#34; }
</span></span><span class="line"><span class="cl">graph LR;
</span></span><span class="line"><span class="cl"> If --&gt; Then
</span></span><span class="line"><span class="cl"> Then --&gt; Else
</span></span><span class="line"><span class="cl">```
</span></span></code></pre></div>
</div>
<div data-tab-item="shortcode" data-tab-group="shortcode-parameter" class="tab-item ">
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="p">{{&lt;</span> <span class="nx">mermaid</span> <span class="nx">align</span><span class="p">=</span><span class="s">&#34;center&#34;</span> <span class="p">&gt;}}</span>
</span></span><span class="line"><span class="cl"><span class="nx">graph</span> <span class="nx">LR</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="nx">If</span> <span class="o">--</span><span class="p">&gt;</span> <span class="nx">Then</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Then</span> <span class="o">--</span><span class="p">&gt;</span> <span class="nx">Else</span>
</span></span><span class="line"><span class="cl"><span class="p">{{&lt;</span> <span class="o">/</span><span class="nx">mermaid</span> <span class="p">&gt;}}</span>
</span></span></code></pre></div>
</div>
<div data-tab-item="partial" data-tab-group="shortcode-parameter" class="tab-item ">
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="p">{{</span> <span class="nx">partial</span> <span class="s">&#34;shortcodes/mermaid.html&#34;</span> <span class="p">(</span><span class="nx">dict</span>
</span></span><span class="line"><span class="cl"> <span class="s">&#34;context&#34;</span> <span class="p">.</span>
</span></span><span class="line"><span class="cl"> <span class="s">&#34;content&#34;</span> <span class="s">&#34;graph LR;\nIf --&gt; Then\nThen --&gt; Else&#34;</span>
</span></span><span class="line"><span class="cl"> <span class="s">&#34;align&#34;</span> <span class="s">&#34;center&#34;</span>
</span></span><span class="line"><span class="cl"><span class="p">)}}</span>
</span></span></code></pre></div>
</div>
</div>
</div>
<p>The generated graphs can be be panned by dragging them and zoomed by using the mousewheel. On mobile devices you can use finger gestures.</p>
<h3 id="parameter">Parameter</h3>
<table>
<thead>
<tr>
<th style="text-align:left">Name</th>
<th style="text-align:left">Default</th>
<th style="text-align:left">Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left"><strong>align</strong></td>
<td style="text-align:left"><code>center</code></td>
<td style="text-align:left">Allowed values are <code>left</code>, <code>center</code> or <code>right</code>.</td>
</tr>
<tr>
<td style="text-align:left"><em><strong>&lt;content&gt;</strong></em></td>
<td style="text-align:left"><em>&lt;empty&gt;</em></td>
<td style="text-align:left">Your Mermaid graph.</td>
</tr>
</tbody>
</table>
<h2 id="configuration">Configuration</h2>
<p>Mermaid is configured with default settings. You can customize Mermaid&rsquo;s default settings for all of your files thru a JSON object in your <code>config.toml</code>, override these settings per page thru your pages frontmatter or override these setting per diagramm thru <a href="https://mermaid-js.github.io/mermaid/#/directives?id=directives">diagram directives</a>.</p>
<p>The JSON object of your <code>config.toml</code> / frontmatter is forwarded into Mermaid&rsquo;s <code>mermaid.initialize()</code> function.</p>
<p>See <a href="http://mermaid-js.github.io/mermaid/#/Setup?id=mermaidapi-configuration-defaults">Mermaid documentation</a> for all allowed settings.</p>
<p>The <code>theme</code> setting can also be set by your used color variant. This will be the sitewide default and can - again - be overridden by your settings in <code>config.toml</code>, frontmatter or diagram directives.</p>
<div class="box notices cstyle note">
<div class="box-label"><i class="fa-fw fas fa-exclamation-circle"></i> Note</div>
<div class="box-content">
<p>To use codefence syntax you have to turn off <code>guessSyntax</code> for the <code>markup.highlight</code> setting.</p>
</div>
</div>
<h3 id="global-configuration-file">Global Configuration File</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="p">[</span><span class="nx">params</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="nx">mermaidInitialize</span> <span class="p">=</span> <span class="s2">&#34;{ \&#34;theme\&#34;: \&#34;dark\&#34; }&#34;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="p">[</span><span class="nx">markup</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="p">[</span><span class="nx">markup</span><span class="p">.</span><span class="nx">highlight</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="c"># if `guessSyntax = true`, there will be no unstyled code even if no language</span>
</span></span><span class="line"><span class="cl"> <span class="c"># was given BUT Mermaid and Math codefences will not work anymore! So this is a</span>
</span></span><span class="line"><span class="cl"> <span class="c"># mandatory setting for your site if you want to use Mermaid codefences</span>
</span></span><span class="line"><span class="cl"> <span class="nx">guessSyntax</span> <span class="p">=</span> <span class="kc">false</span>
</span></span></code></pre></div><h3 id="pages-frontmatter">Page&rsquo;s Frontmatter</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="err">+++</span>
</span></span><span class="line"><span class="cl"><span class="nx">mermaidInitialize</span> <span class="p">=</span> <span class="s2">&#34;{ \&#34;theme\&#34;: \&#34;dark\&#34; }&#34;</span>
</span></span><span class="line"><span class="cl"><span class="err">+++</span>
</span></span></code></pre></div><h2 id="examples">Examples</h2>
<h3 id="flowchart-with-non-default-mermaid-theme">Flowchart with Non-Default Mermaid Theme</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="p">{{&lt;</span> <span class="nx">mermaid</span> <span class="p">&gt;}}</span>
</span></span><span class="line"><span class="cl"><span class="o">%%</span><span class="p">{</span><span class="nx">init</span><span class="p">:{</span><span class="s">&#34;theme&#34;</span><span class="p">:</span><span class="s">&#34;forest&#34;</span><span class="p">}}</span><span class="o">%%</span>
</span></span><span class="line"><span class="cl"><span class="nx">graph</span> <span class="nx">LR</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="nx">A</span><span class="p">[</span><span class="nx">Hard</span> <span class="nx">edge</span><span class="p">]</span> <span class="o">--</span><span class="p">&gt;|</span><span class="nx">Link</span> <span class="nx">text</span><span class="p">|</span> <span class="nf">B</span><span class="p">(</span><span class="nx">Round</span> <span class="nx">edge</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="nx">B</span> <span class="o">--</span><span class="p">&gt;</span> <span class="nx">C</span><span class="p">{&lt;</span><span class="nx">strong</span><span class="p">&gt;</span><span class="nx">Decision</span><span class="p">&lt;</span><span class="o">/</span><span class="nx">strong</span><span class="p">&gt;}</span>
</span></span><span class="line"><span class="cl"> <span class="nx">C</span> <span class="o">--</span><span class="p">&gt;|</span><span class="nx">One</span><span class="p">|</span> <span class="nx">D</span><span class="p">[</span><span class="nx">Result</span> <span class="nx">one</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="nx">C</span> <span class="o">--</span><span class="p">&gt;|</span><span class="nx">Two</span><span class="p">|</span> <span class="nx">E</span><span class="p">[</span><span class="nx">Result</span> <span class="nx">two</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="p">{{&lt;</span> <span class="o">/</span><span class="nx">mermaid</span> <span class="p">&gt;}}</span>
</span></span></code></pre></div>
<div class="mermaid align-center">
%%{init:{&#34;theme&#34;:&#34;forest&#34;}}%%
graph LR;
A[Hard edge] --&gt;|Link text| B(Round edge)
B --&gt; C{&lt;strong&gt;Decision&lt;/strong&gt;}
C --&gt;|One| D[Result one]
C --&gt;|Two| E[Result two]
</div>
<h3 id="sequence">Sequence</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="p">{{&lt;</span> <span class="nx">mermaid</span> <span class="p">&gt;}}</span>
</span></span><span class="line"><span class="cl"><span class="nx">sequenceDiagram</span>
</span></span><span class="line"><span class="cl"> <span class="nx">participant</span> <span class="nx">Alice</span>
</span></span><span class="line"><span class="cl"> <span class="nx">participant</span> <span class="nx">Bob</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Alice</span><span class="o">-&gt;&gt;</span><span class="nx">John</span><span class="p">:</span> <span class="nx">Hello</span> <span class="nx">John</span><span class="p">,</span> <span class="nx">how</span> <span class="nx">are</span> <span class="nx">you</span><span class="err">?</span>
</span></span><span class="line"><span class="cl"> <span class="nx">loop</span> <span class="nx">Healthcheck</span>
</span></span><span class="line"><span class="cl"> <span class="nx">John</span><span class="o">-</span><span class="p">&gt;</span><span class="nx">John</span><span class="p">:</span> <span class="nx">Fight</span> <span class="nx">against</span> <span class="nx">hypochondria</span>
</span></span><span class="line"><span class="cl"> <span class="nx">end</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Note</span> <span class="nx">right</span> <span class="nx">of</span> <span class="nx">John</span><span class="p">:</span> <span class="nx">Rational</span> <span class="nx">thoughts</span> <span class="p">&lt;</span><span class="nx">br</span><span class="p">&gt;</span><span class="nx">prevail</span><span class="o">...</span>
</span></span><span class="line"><span class="cl"> <span class="nx">John</span><span class="o">--</span><span class="p">&gt;</span><span class="nx">Alice</span><span class="p">:</span> <span class="nx">Great</span><span class="p">!</span>
</span></span><span class="line"><span class="cl"> <span class="nx">John</span><span class="o">-</span><span class="p">&gt;</span><span class="nx">Bob</span><span class="p">:</span> <span class="nx">How</span> <span class="nx">about</span> <span class="nx">you</span><span class="err">?</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Bob</span><span class="o">--</span><span class="p">&gt;</span><span class="nx">John</span><span class="p">:</span> <span class="nx">Jolly</span> <span class="nx">good</span><span class="p">!</span>
</span></span><span class="line"><span class="cl"><span class="p">{{&lt;</span> <span class="o">/</span><span class="nx">mermaid</span> <span class="p">&gt;}}</span>
</span></span></code></pre></div>
<div class="mermaid align-center">
sequenceDiagram
participant Alice
participant Bob
Alice-&gt;&gt;John: Hello John, how are you?
loop Healthcheck
John-&gt;John: Fight against hypochondria
end
Note right of John: Rational thoughts &lt;br&gt;prevail...
John--&gt;Alice: Great!
John-&gt;Bob: How about you?
Bob--&gt;John: Jolly good!
</div>
<h3 id="gantt">GANTT</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="p">{{&lt;</span> <span class="nx">mermaid</span> <span class="p">&gt;}}</span>
</span></span><span class="line"><span class="cl"><span class="nx">gantt</span>
</span></span><span class="line"><span class="cl"> <span class="nx">dateFormat</span> <span class="nx">YYYY</span><span class="o">-</span><span class="nx">MM</span><span class="o">-</span><span class="nx">DD</span>
</span></span><span class="line"><span class="cl"> <span class="nx">title</span> <span class="nx">Adding</span> <span class="nx">GANTT</span> <span class="nx">diagram</span> <span class="nx">functionality</span> <span class="nx">to</span> <span class="nx">Mermaid</span>
</span></span><span class="line"><span class="cl"> <span class="nx">section</span> <span class="nx">A</span> <span class="nx">section</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Completed</span> <span class="nx">task</span> <span class="p">:</span><span class="nx">done</span><span class="p">,</span> <span class="nx">des1</span><span class="p">,</span> <span class="mi">2014</span><span class="o">-</span><span class="mo">01</span><span class="o">-</span><span class="mo">06</span><span class="p">,</span><span class="mi">2014</span><span class="o">-</span><span class="mo">01</span><span class="o">-</span><span class="mi">08</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Active</span> <span class="nx">task</span> <span class="p">:</span><span class="nx">active</span><span class="p">,</span> <span class="nx">des2</span><span class="p">,</span> <span class="mi">2014</span><span class="o">-</span><span class="mo">01</span><span class="o">-</span><span class="mi">09</span><span class="p">,</span> <span class="mi">3</span><span class="nx">d</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Future</span> <span class="nx">task</span> <span class="p">:</span> <span class="nx">des3</span><span class="p">,</span> <span class="nx">after</span> <span class="nx">des2</span><span class="p">,</span> <span class="mi">5</span><span class="nx">d</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Future</span> <span class="nx">task2</span> <span class="p">:</span> <span class="nx">des4</span><span class="p">,</span> <span class="nx">after</span> <span class="nx">des3</span><span class="p">,</span> <span class="mi">5</span><span class="nx">d</span>
</span></span><span class="line"><span class="cl"> <span class="nx">section</span> <span class="nx">Critical</span> <span class="nx">tasks</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Completed</span> <span class="nx">task</span> <span class="nx">in</span> <span class="nx">the</span> <span class="nx">critical</span> <span class="nx">line</span> <span class="p">:</span><span class="nx">crit</span><span class="p">,</span> <span class="nx">done</span><span class="p">,</span> <span class="mi">2014</span><span class="o">-</span><span class="mo">01</span><span class="o">-</span><span class="mo">06</span><span class="p">,</span><span class="mi">24</span><span class="nx">h</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Implement</span> <span class="nx">parser</span> <span class="nx">and</span> <span class="nx">jison</span> <span class="p">:</span><span class="nx">crit</span><span class="p">,</span> <span class="nx">done</span><span class="p">,</span> <span class="nx">after</span> <span class="nx">des1</span><span class="p">,</span> <span class="mi">2</span><span class="nx">d</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Create</span> <span class="nx">tests</span> <span class="k">for</span> <span class="nx">parser</span> <span class="p">:</span><span class="nx">crit</span><span class="p">,</span> <span class="nx">active</span><span class="p">,</span> <span class="mi">3</span><span class="nx">d</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Future</span> <span class="nx">task</span> <span class="nx">in</span> <span class="nx">critical</span> <span class="nx">line</span> <span class="p">:</span><span class="nx">crit</span><span class="p">,</span> <span class="mi">5</span><span class="nx">d</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Create</span> <span class="nx">tests</span> <span class="k">for</span> <span class="nx">renderer</span> <span class="p">:</span><span class="mi">2</span><span class="nx">d</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Add</span> <span class="nx">to</span> <span class="nx">Mermaid</span> <span class="p">:</span><span class="mi">1</span><span class="nx">d</span>
</span></span><span class="line"><span class="cl"><span class="p">{{&lt;</span> <span class="o">/</span><span class="nx">mermaid</span> <span class="p">&gt;}}</span>
</span></span></code></pre></div>
<div class="mermaid align-center">
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram functionality to Mermaid
section A section
Completed task :done, des1, 2014-01-06,2014-01-08
Active task :active, des2, 2014-01-09, 3d
Future task : des3, after des2, 5d
Future task2 : des4, after des3, 5d
section Critical tasks
Completed task in the critical line :crit, done, 2014-01-06,24h
Implement parser and jison :crit, done, after des1, 2d
Create tests for parser :crit, active, 3d
Future task in critical line :crit, 5d
Create tests for renderer :2d
Add to Mermaid :1d
</div>
<h3 id="class-diagram-aligned-to-the-right">Class Diagram Aligned to the Right</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="p">{{&lt;</span> <span class="nx">mermaid</span> <span class="nx">align</span><span class="p">=</span><span class="s">&#34;right&#34;</span> <span class="p">&gt;}}</span>
</span></span><span class="line"><span class="cl"><span class="nx">classDiagram</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class01</span> <span class="p">&lt;|</span><span class="o">--</span> <span class="nx">AveryLongClass</span> <span class="p">:</span> <span class="nx">Cool</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class03</span> <span class="o">*--</span> <span class="nx">Class04</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class05</span> <span class="nx">o</span><span class="o">--</span> <span class="nx">Class06</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class07</span> <span class="p">..</span> <span class="nx">Class08</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class09</span> <span class="o">--</span><span class="p">&gt;</span> <span class="nx">C2</span> <span class="p">:</span> <span class="nx">Where</span> <span class="nx">am</span> <span class="nx">i</span><span class="err">?</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class09</span> <span class="o">--*</span> <span class="nx">C3</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class09</span> <span class="o">--</span><span class="p">|&gt;</span> <span class="nx">Class07</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class07</span> <span class="p">:</span> <span class="nf">equals</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class07</span> <span class="p">:</span> <span class="nx">Object</span><span class="p">[]</span> <span class="nx">elementData</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class01</span> <span class="p">:</span> <span class="nf">size</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class01</span> <span class="p">:</span> <span class="kt">int</span> <span class="nx">chimp</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class01</span> <span class="p">:</span> <span class="kt">int</span> <span class="nx">gorilla</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Class08</span> <span class="o">&lt;--</span><span class="p">&gt;</span> <span class="nx">C2</span><span class="p">:</span> <span class="nx">Cool</span> <span class="nx">label</span>
</span></span><span class="line"><span class="cl"><span class="p">{{&lt;</span> <span class="o">/</span><span class="nx">mermaid</span> <span class="p">&gt;}}</span>
</span></span></code></pre></div>
<div class="mermaid align-right">
classDiagram
Class01 &lt;|-- AveryLongClass : Cool
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 --&gt; C2 : Where am i?
Class09 --* C3
Class09 --|&gt; Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
Class08 &lt;--&gt; C2: Cool label
</div>
<h3 id="state-diagram-with-codefence-syntax">State Diagram with Codefence Syntax</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="s">```mermaid
</span></span></span><span class="line"><span class="cl"><span class="s">stateDiagram-v2
</span></span></span><span class="line"><span class="cl"><span class="s"> open: Open Door
</span></span></span><span class="line"><span class="cl"><span class="s"> closed: Closed Door
</span></span></span><span class="line"><span class="cl"><span class="s"> locked: Locked Door
</span></span></span><span class="line"><span class="cl"><span class="s"> open --&gt; closed: Close
</span></span></span><span class="line"><span class="cl"><span class="s"> closed --&gt; locked: Lock
</span></span></span><span class="line"><span class="cl"><span class="s"> locked --&gt; closed: Unlock
</span></span></span><span class="line"><span class="cl"><span class="s"> closed --&gt; open: Open
</span></span></span><span class="line"><span class="cl"><span class="s">```</span>
</span></span></code></pre></div>
<div class="mermaid align-center">stateDiagram-v2
open: Open Door
closed: Closed Door
locked: Locked Door
open --&gt; closed: Close
closed --&gt; locked: Lock
locked --&gt; closed: Unlock
closed --&gt; open: Open</div>
<footer class="footline">
</footer>
</article>
</div>
</main>
</div>
<script src="../../js/clipboard.min.js?1668719585" defer></script>
<script src="../../js/perfect-scrollbar.min.js?1668719585" defer></script>
<script src="../../js/featherlight.min.js?1668719585" defer></script>
<script src="../../js/jquery.svg.pan.zoom.js?1668719585" defer></script>
<script src="../../js/mermaid.min.js?1668719585" defer></script>
<script>
window.themeUseMermaid = JSON.parse("{ \"securityLevel\": \"loose\" }");
</script>
<script src="../../js/theme.js?1668719585" defer></script>
</body>
</html>