Skip to content

Commit ed4e9d9

Browse files
committed
Mermaid images (PR #2178)
2 parents 6069e25 + 0ab87b7 commit ed4e9d9

18 files changed

Lines changed: 368 additions & 1 deletion

doc/guide/author/topics.xml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3143,6 +3143,62 @@ displayed line, and there are no <c>\\</c>s. Use <c>\amp</c> to mark the alignm
31433143

31443144
<p>Note the necessity of using the <c>pretext</c> script (<xref ref="pretext-script"/>) to independently invoke Sage, no matter what sort of output is being created for your document.</p>
31453145
</subsubsection>
3146+
3147+
<subsubsection xml:id="topic-mermaid">
3148+
<title>Mermaid</title>
3149+
3150+
<p><url href="https://mermaid.js.org/" visual="mermaid.js.org">Mermaid</url> is a Markdown-inspired tool for authoring various kinds of diagrams. One kind of diagram - a git commit visualization - is shown below. For a full listing of diagram types, see the <url href="https://mermaid.js.org/intro/#diagram-types">Mermaid Documentation</url>. The <url href="https://mermaid.live/" visual="mermaid.live">Mermaid live editor</url>is a great tool for testing the syntax of your mermaid diagrams.</p>
3151+
3152+
<p>In PreTeXt, you can specify a Mermaid theme via <attr>common/mermaid/@theme</attr></p>
3153+
3154+
<p>To author a Mermaid diagram, use a <tag>image</tag> that contains a <tag>mermaid</tag> element.</p>
3155+
3156+
<pre>
3157+
&lt;figure xml:id="figure-mermaid-git"&gt;
3158+
&lt;caption&gt;Mermaid Git Diagram&gt;/caption&gt;
3159+
&lt;image xml:id="mermaid-git-image"&gt;
3160+
&lt;mermaid&gt;
3161+
---
3162+
title: Example Git diagram
3163+
---
3164+
gitGraph
3165+
commit
3166+
commit
3167+
branch develop
3168+
checkout develop
3169+
commit
3170+
commit
3171+
checkout main
3172+
merge develop
3173+
commit
3174+
commit
3175+
&lt;/mermaid&gt;
3176+
&lt;/image&gt;
3177+
&lt;/figure&gt;
3178+
</pre>
3179+
3180+
<figure xml:id="figure-mermaid-git">
3181+
<caption>Mermaid Git Diagram</caption>
3182+
<image xml:id="mermaid-git-image">
3183+
<mermaid>
3184+
---
3185+
title: Example Git diagram
3186+
---
3187+
gitGraph
3188+
commit
3189+
commit
3190+
branch develop
3191+
checkout develop
3192+
commit
3193+
commit
3194+
checkout main
3195+
merge develop
3196+
commit
3197+
commit
3198+
</mermaid>
3199+
</image>
3200+
</figure>
3201+
</subsubsection>
31463202
</subsection>
31473203

31483204
<subsection>
103 KB
Loading
98.2 KB
Loading

doc/guide/publisher/publication-file.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@
134134
<p>In the text itself avoid obscure characters or symbols, and do not use any markup. Keep it simple. When used with <latex/> output the scharacters <c>\\</c> will survive in the text to create multiple lines of text in the watermark. This feature is implemented for <latex/> and <init>HTML</init> output. See <xref ref="watermarks"/> for more detail and an example.</p>
135135
</subsection>
136136

137+
<subsection xml:id="common-mermaid">
138+
<title>Mermaid</title>
139+
<idx><h>Mermaid themes</h></idx>
140+
141+
<p>
142+
Various themes are available for Mermaid diagrams. To use a theme, set
143+
<cd>
144+
<cline>/publication/common/mermaid/@theme</cline>
145+
</cd>
146+
with a value of the theme name. The default theme is <c>default</c>.
147+
See <xref ref="topic-mermaid"/> for more information on Mermaid diagrams.
148+
</p>
149+
</subsection>
150+
137151
<subsection xml:id="common-qrcode-image">
138152
<title>QR code image</title>
139153
<idx><h>common option</h><h>qrcode</h></idx>
130 KB
Loading
135 KB
Loading
98.1 KB
Loading
101 KB
Loading
158 KB
Loading
162 KB
Loading

0 commit comments

Comments
 (0)