feat(docs): improve documentation on Mermaid

This commit is contained in:
Elian Doran
2025-04-04 21:56:44 +03:00
parent 2a8ab728a7
commit be3e213ba3
39 changed files with 779 additions and 195 deletions

View File

@@ -1803,6 +1803,86 @@
"dataFileName": "Split View_1_Split View_im.png"
}
]
},
{
"isClone": false,
"noteId": "XpOYSgsLkTJy",
"notePath": [
"pOsGYCXsbNQG",
"gh7bpGYxajRS",
"Vc8PjrjAGuOp",
"XpOYSgsLkTJy"
],
"title": "Floating buttons",
"notePosition": 150,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "label",
"name": "iconClass",
"value": "bx bx-rectangle",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "s1aBHPd79XYj",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "grjYqerjn243",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "iPIMuisry3hd",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "CoFPLs3dRlXc",
"isInheritable": false,
"position": 60
}
],
"format": "html",
"dataFileName": "Floating buttons.html",
"attachments": [
{
"attachmentId": "drdKIHK5GzfU",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Floating buttons_image.png"
},
{
"attachmentId": "FNh39vXBEZxT",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "1_Floating buttons_image.png"
}
]
}
]
},
@@ -4060,6 +4140,98 @@
"position": 10,
"dataFileName": "10_Images_image.png"
}
],
"dirFileName": "Images",
"children": [
{
"isClone": false,
"noteId": "0Ofbk1aSuVRu",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"iPIMuisry3hd",
"mT0HEkOsz6i1",
"0Ofbk1aSuVRu"
],
"title": "Image references",
"notePosition": 10,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "s1aBHPd79XYj",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "gBbsAeiuUxI5",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "iPIMuisry3hd",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "XpOYSgsLkTJy",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "grjYqerjn243",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "s8alTXmpFR61",
"isInheritable": false,
"position": 70
}
],
"format": "html",
"dataFileName": "Image references.html",
"attachments": [
{
"attachmentId": "6OgYPJ60Uz76",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Image references_image.png"
},
{
"attachmentId": "72VNSgANtMVT",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "1_Image references_image.png"
},
{
"attachmentId": "kXBghrixmV2J",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "2_Image references_image.png"
}
]
}
]
},
{
@@ -4913,6 +5085,20 @@
"value": "bx bx-selection",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "XpOYSgsLkTJy",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "0Ofbk1aSuVRu",
"isInheritable": false,
"position": 40
}
],
"format": "html",
@@ -4926,6 +5112,22 @@
"position": 10,
"dataFileName": "Mermaid Diagrams_ELK off.svg"
},
{
"attachmentId": "EN4DhmgiSH6t",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Mermaid Diagrams_image.png"
},
{
"attachmentId": "if9nzuWHt5KP",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "1_Mermaid Diagrams_image.png"
},
{
"attachmentId": "IKxo3tblVDHq",
"title": "ELK on.svg",
@@ -4933,63 +5135,60 @@
"mime": "image/svg+xml",
"position": 10,
"dataFileName": "Mermaid Diagrams_ELK on.svg"
},
{
"attachmentId": "TpPwoCFIePXm",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "2_Mermaid Diagrams_image.png"
}
],
"dirFileName": "Mermaid Diagrams",
"children": [
{
"isClone": false,
"noteId": "opAFABmyb3CU",
"noteId": "RH6yLjjWJHof",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"s1aBHPd79XYj",
"opAFABmyb3CU"
"RH6yLjjWJHof"
],
"title": "ELK on",
"notePosition": 10,
"title": "ELK layout",
"notePosition": 30,
"prefix": null,
"isExpanded": false,
"type": "mermaid",
"mime": "text/plain",
"attributes": [],
"dataFileName": "ELK on.txt",
"attachments": [
"type": "text",
"mime": "text/html",
"attributes": [
{
"attachmentId": "biyznKlYQ7my",
"title": "mermaid-export.svg",
"role": "image",
"mime": "image/svg+xml",
"position": 10,
"dataFileName": "ELK on_mermaid-export.svg"
"type": "label",
"name": "iconClass",
"value": "bx bxs-network-chart",
"isInheritable": false,
"position": 10
}
]
},
{
"isClone": false,
"noteId": "r44dpvA1xFu8",
"notePath": [
"pOsGYCXsbNQG",
"KSZ04uQ2D1St",
"s1aBHPd79XYj",
"r44dpvA1xFu8"
],
"title": "ELK off",
"notePosition": 20,
"prefix": null,
"isExpanded": false,
"type": "mermaid",
"mime": "text/plain",
"attributes": [],
"dataFileName": "ELK off.txt",
"format": "html",
"dataFileName": "ELK layout.html",
"attachments": [
{
"attachmentId": "rQI7SXljnpJM",
"title": "mermaid-export.svg",
"attachmentId": "DOY5C5S4vCs7",
"title": "ELK off.svg",
"role": "image",
"mime": "image/svg+xml",
"position": 10,
"dataFileName": "ELK off_mermaid-export.svg"
"dataFileName": "ELK layout_ELK off.svg"
},
{
"attachmentId": "E1ysxcfkmGBZ",
"title": "ELK on.svg",
"role": "image",
"mime": "image/svg+xml",
"position": 10,
"dataFileName": "ELK layout_ELK on.svg"
}
]
}
@@ -5004,7 +5203,7 @@
"grjYqerjn243"
],
"title": "Canvas",
"notePosition": 160,
"notePosition": 170,
"prefix": null,
"isExpanded": false,
"type": "text",
@@ -5040,7 +5239,7 @@
"1vHRoWCEjj0L"
],
"title": "Web View",
"notePosition": 170,
"notePosition": 180,
"prefix": null,
"isExpanded": false,
"type": "text",
@@ -5067,7 +5266,7 @@
"gBbsAeiuUxI5"
],
"title": "Mind Map",
"notePosition": 180,
"notePosition": 190,
"prefix": null,
"isExpanded": false,
"type": "text",
@@ -5094,7 +5293,7 @@
"81SGnPGMk7Xc"
],
"title": "Geo map",
"notePosition": 190,
"notePosition": 200,
"prefix": null,
"isExpanded": false,
"type": "text",

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,41 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../../style.css">
<base target="_parent">
<title data-trilium-title>Floating buttons</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>Floating buttons</h1>
<div class="ck-content">
<figure class="image">
<img style="aspect-ratio:893/144;" src="Floating buttons_image.png" width="893"
height="144">
</figure>
<p>Depending on the current note, a panel will appear near the top-right
of the note, right underneath the&nbsp;<a class="reference-link" href="Ribbon.html">Ribbon</a>.
These buttons offer additional interaction that is specific to that particular
note.</p>
<p>For example:</p>
<ul>
<li>For&nbsp;<a class="reference-link" href="../../Note%20Types/Mermaid%20Diagrams.html">Mermaid Diagrams</a>&nbsp;and&nbsp;
<a
class="reference-link" href="../../Note%20Types/Canvas.html">Canvas</a>, there are buttons to download the SVG representation of the
note, or to copy a reference to the note for pasting it a&nbsp;<a class="reference-link"
href="../../Note%20Types/Text.html">Text</a>&nbsp;note.</li>
<li>For <a href="../Notes/Read-Only%20Notes.html">read-only notes</a>, there
is a button to temporarily edit the note for quick modifications.</li>
</ul>
<h2>Interaction</h2>
<p>The floating button area can be collapsed by pressing the two right arrows
at the end of the section.</p>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -13,47 +13,73 @@
<h1 data-trilium-h1>Mermaid Diagrams</h1>
<div class="ck-content">
<figure class="image image-style-align-center">
<img style="aspect-ratio:886/663;" src="2_Mermaid Diagrams_image.png"
width="886" height="663">
</figure>
<p>Trilium supports Mermaid, which adds support for various diagrams such
as flowchart, sequence diagram, class diagram, state diagram, pie charts,
etc., all using a text description of the chart instead of manually drawing
the diagram.</p>
<p>For the official documentation of Mermaid.js see <a href="https://mermaid.js.org/intro/">mermaid.js.org/intro/</a>.</p>
<h2>ELK layout engine</h2>
<p>Mermaid supports a different layout engine which supports slightly more
complex diagrams, called the <a href="https://eclipse.dev/elk/">Eclipse Layout Kernel (ELK)</a>.
Trilium has support for these as well, but it's not enabled by default.</p>
<p>In order to activate ELK for any diagram, insert the following YAML frontmatter
right at the beginning of the diagram:</p><pre><code class="language-text-x-yaml">---
config:
layout: elk
---</code></pre>
<figure class="table">
<table>
<thead>
<tr>
<th>With ELK off</th>
<th>With ELK on</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<figure class="image">
<img style="aspect-ratio:513/442;" src="Mermaid Diagrams_ELK off.svg"
width="513" height="442">
</figure>
<p>&nbsp;</p>
</td>
<td>
<figure class="image">
<img style="aspect-ratio:531/491;" src="Mermaid Diagrams_ELK on.svg" width="531"
height="491">
</figure>
</td>
</tr>
</tbody>
</table>
</figure>
<h2>Layouts</h2>
<p>Depending on the chart being edited and user preference, there are two
layouts supported by the Mermaid note type:</p>
<ul>
<li>Horizontal, where the source code (editable part) is on the left side
of the screen and the preview is to the right.</li>
<li>Vertical, where the source code is at the bottom of the screen and the
preview is at the top.</li>
</ul>
<p>It's possible to switch between the two layouts at any time by pressing
the
<img src="Mermaid Diagrams_image.png" width="16" height="16">icon in the&nbsp;<a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Floating%20buttons.html">Floating buttons</a>&nbsp;area.</p>
<h2>Interaction</h2>
<ul>
<li>The source code of the diagram (in Mermaid format) is displayed on the
left or bottom side of the note (depending on the layout).
<ul>
<li>Changing the diagram code will refresh automatically the diagram.</li>
</ul>
</li>
<li>The preview of the diagram is displayed at the right or top side of the
note (depending on the layout):
<ul>
<li>There are dedicated buttons at the bottom-right of the preview to control
the zoom in, zoom out or re-center the diagram:
<img src="1_Mermaid Diagrams_image.png"
width="90" height="18">
</li>
<li>The preview can be moved around by holding the left mouse button and dragging.</li>
<li>Zooming can also be done by using the scroll wheel.</li>
<li>The zoom and position on the preview will remain fixed as the diagram
changes, to be able to work more easily with large diagrams.</li>
</ul>
</li>
<li>In the&nbsp;<a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Floating%20buttons.html">Floating buttons</a>&nbsp;area:
<ul>
<li>The source/preview can be laid out left-right or bottom-top via the <em>Move editing pane to the left / bottom </em>option.</li>
<li>Press <em>Lock editing</em> to automatically mark the note as read-only.
In this mode, the code pane is hidden and the diagram is displayed full-size.
Similarly, press <em>Unlock editing</em> to mark a read-only note as editable.</li>
<li>Press the <em>Copy image reference to the clipboard</em> to be able to insert
the image representation of the diagram into a text note. See&nbsp;<a class="reference-link"
href="Text/Images/Image%20references.html">Image references</a>&nbsp;for
more information.</li>
<li>Press the <em>Export diagram as SVG</em> to download a scalable/vector rendering
of the diagram. Can be used to present the diagram without degrading when
zooming.</li>
<li>Press the <em>Export diagram as PNG</em> to download a normal image (at
1x scale, raster) of the diagram. Can be used to send the diagram in more
traditional channels such as e-mail.</li>
</ul>
</li>
</ul>
<h2>Errors in the diagram</h2>
<p>If there is an error in the source code, the error will be displayed in
an information pane.</p>
<p>During the state of an error, the diagram will no longer be rendered and
the previously working diagram will remain in the preview section.</p>
</div>
</div>
</body>

View File

@@ -0,0 +1,55 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../../style.css">
<base target="_parent">
<title data-trilium-title>ELK layout</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>ELK layout</h1>
<div class="ck-content">
<p>Mermaid supports a different layout engine which supports slightly more
complex diagrams, called the <a href="https://eclipse.dev/elk/">Eclipse Layout Kernel (ELK)</a>.
Trilium has support for these as well, but it's not enabled by default.</p>
<p>In order to activate ELK for any diagram, insert the following YAML frontmatter
right at the beginning of the diagram:</p><pre><code class="language-text-x-yaml">---
config:
layout: elk
---</code></pre>
<figure class="table">
<table>
<thead>
<tr>
<th>With ELK off</th>
<th>With ELK on</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<figure class="image">
<img style="aspect-ratio:513/442;" src="ELK layout_ELK off.svg" width="513"
height="442">
</figure>
<p>&nbsp;</p>
</td>
<td>
<figure class="image">
<img style="aspect-ratio:531/491;" src="ELK layout_ELK on.svg" width="531"
height="491">
</figure>
</td>
</tr>
</tbody>
</table>
</figure>
</div>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -1,14 +0,0 @@
---
title: Interfaces for B
---
flowchart LR
A-->|"Guarantee"|B
C-->|"User attributes"|B
C-.->|"Master data"|B
C-->|"Exchange Rate"|B
C-->|"Profit Centers"|B
C-->|"Vendor Partners"|B
C-->|"Work Situation"|B
C-->|"Customer"|B
C-->|"Profit Centers"|B
B-->|"Guarantee"|C

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,16 +0,0 @@
---
title: Interfaces for B
config:
layout: elk
---
flowchart LR
A-->|"Guarantee"|B
C-->|"User attributes"|B
C-.->|"Master data"|B
C-->|"Exchange Rate"|B
C-->|"Profit Centers"|B
C-->|"Vendor Partners"|B
C-->|"Work Situation"|B
C-->|"Customer"|B
C-->|"Profit Centers"|B
B-->|"Guarantee"|C

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

View File

@@ -0,0 +1,52 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../../../style.css">
<base target="_parent">
<title data-trilium-title>Image references</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>Image references</h1>
<div class="ck-content">
<figure class="image image-style-align-center">
<img style="aspect-ratio:880/553;" src="Image references_image.png" width="880"
height="553">
</figure>
<p>Image references are an easy way to embed the preview of another note
type into a&nbsp;<a class="reference-link" href="../../Text.html">Text</a>&nbsp;note.</p>
<h2>Supported note types</h2>
<ul>
<li><a class="reference-link" href="../../Canvas.html">Canvas</a>
</li>
<li><a class="reference-link" href="../../Mermaid%20Diagrams.html">Mermaid Diagrams</a>
</li>
<li><a class="reference-link" href="../../Mind%20Map.html">Mind Map</a>
</li>
</ul>
<h2>Steps</h2>
<ol>
<li>Go to one of the supported notes (listed above) and look for the
<img src="1_Image references_image.png"
width="18" height="18">button in the&nbsp;<a class="reference-link" href="../../../Basic%20Concepts%20and%20Features/UI%20Elements/Floating%20buttons.html">Floating buttons</a>&nbsp;area.</li>
<li>Go to a&nbsp;<a class="reference-link" href="../../Text.html">Text</a>&nbsp;note
and use the Paste function to insert the reference to that note.</li>
</ol>
<h2>Interaction</h2>
<ul>
<li>Double-clicking an image reference from a text note will automatically
open the target note.</li>
<li>Clicking an image reference while <kbd>Ctrl</kbd> is pressed will open the
target note in a new tab.</li>
<li>Modifying the target note should also update the image reference. If that
doesn't happen, consider&nbsp;<a class="reference-link" href="../../../Troubleshooting/Refreshing%20the%20application.html">Refreshing the application</a>.</li>
</ul>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -109,6 +109,9 @@
<li><a href="User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Split%20View.html"
target="detail">Split View</a>
</li>
<li><a href="User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Floating%20buttons.html"
target="detail">Floating buttons</a>
</li>
</ul>
</li>
<li><a href="User%20Guide/Basic%20Concepts%20and%20Features/Notes.html" target="detail">Notes</a>
@@ -219,6 +222,11 @@
<li><a href="User%20Guide/Note%20Types/Text/Formatting%20toolbar.html" target="detail">Formatting toolbar</a>
</li>
<li><a href="User%20Guide/Note%20Types/Text/Images.html" target="detail">Images</a>
<ul>
<li><a href="User%20Guide/Note%20Types/Text/Images/Image%20references.html"
target="detail">Image references</a>
</li>
</ul>
</li>
<li><a href="User%20Guide/Note%20Types/Text/Links.html" target="detail">Links</a>
</li>
@@ -254,9 +262,8 @@
</li>
<li><a href="User%20Guide/Note%20Types/Mermaid%20Diagrams.html" target="detail">Mermaid Diagrams</a>
<ul>
<li><a href="User%20Guide/Note%20Types/Mermaid%20Diagrams/ELK%20on.txt" target="detail">ELK on</a>
</li>
<li><a href="User%20Guide/Note%20Types/Mermaid%20Diagrams/ELK%20off.txt" target="detail">ELK off</a>
<li><a href="User%20Guide/Note%20Types/Mermaid%20Diagrams/ELK%20layout.html"
target="detail">ELK layout</a>
</li>
</ul>
</li>