Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Add new markdown guide modal in the editor

Smaug6739cfe82c90d25d
diff --git a/frontend/app/components/MarkdownEditor/ModalSyntax.vue b/frontend/app/components/MarkdownEditor/ModalSyntax.vue
new file mode 100644
index 00000000..1ce793b3
--- /dev/null
+++ b/frontend/app/components/MarkdownEditor/ModalSyntax.vue
@@ -0,0 +1,232 @@
+<template>
+ <div class="modal">
+ <div class="markdown-doc">
+ <h1>πŸ“˜ Alexandrie Markdown Syntax Guide</h1>
+ <p>This guide shows you how to use Alexandrie’s extended Markdown features to create expressive and organized notes.</p>
+
+ <h2>✍️ Basic Formatting</h2>
+ <ul>
+ <li><strong>Bold</strong>: <code>**bold**</code> or <code>__bold__</code></li>
+ <li><em>Italic</em>: <code>*italic*</code></li>
+ <li><u>Underline</u>: <code>_underline_</code></li>
+ <li><del>Strikethrough</del>: <code>~~strikethrough~~</code></li>
+ <li><mark>Highlight</mark>: <code>==highlight==</code></li>
+ </ul>
+
+ <strong>Tags: </strong> <tag blue>Info</tag> <tag green>Success</tag><tag red>Danger</tag><tag yellow>Yellow</tag> <tag grey>Note</tag> <tag teal>Teal</tag>
+ <pre>
+&lt;tag blue&gt;Info&lt;/tag&gt;
+&lt;tag green&gt;Success&lt;/tag&gt;
+&lt;tag red&gt;Danger&lt;/tag&gt;
+&lt;tag yellow&gt;Yellow&lt;/tag&gt;
+&lt;tag grey&gt;Note&lt;/tag&gt;
+&lt;tag teal>Teal&lt;/tag></pre
+ >
+
+ <strong>Colors: </strong>
+ <strong
+ ><span style="color: var(--blue)">blue</span> ; <span style="color: var(--red)">red</span> ; <span style="color: var(--green)">green</span> ; <span style="color: var(--yellow)">yellow</span> ;
+ <span style="color: var(--primary)">primary</span> ; <span style="color: var(--purple)">purple</span> ; <span style="color: var(--pink)">pink</span> ; <span style="color: var(--teal)">teal</span></strong
+ >
+
+ <pre>
+{color:blue}(blue) ; {color:red}(red) ; {color:green}(green) ; {color:yellow}(yellow) ; {color:primary}(primary) ; {color:purple}(purple) ; {color:pink}(pink) ; {color:teal}(teal)
+
+Custom RGB allowed: {color:#2cafcc}(custom 1) {color:#34b125}(custom 2)</pre
+ >
+
+ <h2>πŸ”’ Headings</h2>
+
+ <ul>
+ <li>H1: <code># Heading 1</code></li>
+ <li>H2: <code>## Heading 2</code></li>
+ <li>H3: <code>### Heading 3</code></li>
+ <li>H4: <code>#### Heading 4</code></li>
+ <li>H5: <code>##### Heading 5</code></li>
+ <li>H6: <code>###### Heading 6</code></li>
+ </ul>
+ <pre>
+# Heading 1
+## Heading 2
+### Heading 3</pre
+ >
+ <h2>πŸ’¬ Blockquotes</h2>
+ <p>Use the greater-than symbol to create blockquotes:</p>
+ <pre>
+> This is a blockquote.
+> It can span multiple lines.</pre
+ >
+ <h2>πŸ”— Links & Images</h2>
+ <ul>
+ <li><a href="https://example.com">Example link</a>: <code>[Example link](https://example.com)</code></li>
+ <li><img src="" alt="Image" />: <code>![Alt text](image-url)</code></li>
+ </ul>
+
+ <h2>🧾 Lists & Tables</h2>
+ <ul>
+ <li>Unordered: <code>- Item</code></li>
+ <li>Ordered: <code>1. Item</code></li>
+ </ul>
+ <p>Table syntax:</p>
+ <div style="display: flex; gap: 1rem; flex-wrap: wrap">
+ <table>
+ <thead>
+ <tr>
+ <th>Header 1</th>
+ <th>Header 2</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Row 1</td>
+ <td>Cell 1</td>
+ </tr>
+ <tr>
+ <td>Row 2</td>
+ <td>Cell 2</td>
+ </tr>
+ </tbody>
+ </table>
+ <pre>
+| Header 1 | Header 2 |
+|----------|----------|
+| Row 1 | Cell 1 |
+| Row 2 | Cell 2 |</pre
+ >
+ </div>
+
+ <h2>πŸ’» Code</h2>
+ <p>Inline: <code>`inline code`</code></p>
+ <p>Multiline:</p>
+ <pre>
+```javascript
+function hello() {
+ console.log("Hello, world!");
+}
+```</pre
+ >
+ <h2>πŸ“ Horizontal Rules</h2>
+ <p><code>---</code>, <code>***</code>, or <code>___</code> renders a line:</p>
+ <hr />
+
+ <h2>🎨 Colored Blocks</h2>
+ <p>Use triple-colon blocks to insert styled sections:</p>
+ <div style="display: flex; align-items: center; flex-wrap: wrap">
+ <span style="flex: 1; margin-right: 10px">
+ <pre style="color: white; padding: 5px">:::blue INFO<br/>:::</pre>
+ </span>
+ <span style="flex: 1; margin-left: 10px"
+ ><div class="blue custom-block"><p class="custom-block-title">INFO</p></div></span
+ >
+ </div>
+ <div style="display: flex">
+ <span style="flex: 1; margin-right: 10px">
+ <pre style="color: white; padding: 5px">:::green SUCCESS<br/>:::</pre>
+ </span>
+ <span style="flex: 1; margin-left: 10px"
+ ><div class="green custom-block"><p class="custom-block-title">SUCCESS</p></div></span
+ >
+ </div>
+ <div style="display: flex">
+ <span style="flex: 1; margin-right: 10px">
+ <pre style="color: white; padding: 5px">:::yellow WARNING<br/>:::</pre>
+ </span>
+ <span style="flex: 1; margin-left: 10px"
+ ><div class="yellow custom-block"><p class="custom-block-title">WARNING</p></div></span
+ >
+ </div>
+ <div style="display: flex">
+ <span style="flex: 1; margin-right: 10px">
+ <pre style="color: white; padding: 5px">:::grey NOTE<br/>:::</pre>
+ </span>
+ <span style="flex: 1; margin-left: 10px"
+ ><div class="grey custom-block"><p class="custom-block-title">NOTE</p></div></span
+ >
+ </div>
+ <div style="display: flex">
+ <span style="flex: 1; margin-right: 10px">
+ <pre style="color: white; padding: 5px">:::red DANGER<br/>:::</pre>
+ </span>
+ <span style="flex: 1; margin-left: 10px"
+ ><div class="red custom-block"><p class="custom-block-title">DANGER</p></div></span
+ >
+ </div>
+ <div style="display: flex">
+ <span style="flex: 1; margin-right: 10px">
+ <pre style="color: white; padding: 5px">:::teal TEAL<br/>:::</pre>
+ </span>
+ <span style="flex: 1; margin-left: 10px"
+ ><div class="teal custom-block"><p class="custom-block-title">TEAL</p></div></span
+ >
+ </div>
+ <h2>πŸ“š Special Blocks</h2>
+ <p>These enhance your note structure visually and semantically:</p>
+ <ul>
+ <li><code>:::center</code> – center-aligned content</li>
+ <li><code>:::no-print</code> – content hidden in PDF export</li>
+ <li><code>:::details</code> – collapsible content</li>
+ <li><code>:::definition [Title]</code></li>
+ <li><code>:::theorem [Title]</code></li>
+ <li><code>:::property [Title]</code></li>
+ </ul>
+ <p>Examples:</p>
+ <pre>
+:::center
+This text is centered!
+:::</pre
+ >
+ <pre>
+:::no-print
+This content will not appear in PDF exports.
+:::</pre
+ >
+
+ <pre>
+:::details
+Click to reveal hidden content.
+:::</pre
+ >
+
+ <pre>
+:::definition What is Markdown?
+Markdown is a lightweight markup language.
+:::</pre
+ >
+
+ <pre>
+:::theorem Pythagoras
+aΒ² + bΒ² = cΒ²
+:::</pre
+ >
+
+ <pre>
+:::info-u Quick Tip
+Snippets help you focus on writing, not formatting.
+:::</pre
+ >
+
+ <h2>πŸ“€ Export</h2>
+ <p>Export your notes to PDF, automatically hiding private/debug blocks for a clean result.</p>
+
+ <h2>πŸ’‘ Tips</h2>
+ <ul>
+ <li>Combine blocks for complex notes: math + code + definition</li>
+ <li>Use <code>:::details</code> to hide advanced explanations</li>
+ <li>Exported PDF respects layout and styles</li>
+ </ul>
+ </div>
+ </div>
+</template>
+
+<style scoped>
+.markdown-doc {
+ margin: auto;
+ line-height: 1.7;
+}
+.markdown-doc pre {
+ color: white;
+ padding: 0.75rem;
+ border-radius: 6px;
+ overflow-x: auto;
+}
+</style>
diff --git a/frontend/app/components/MarkdownEditor/Toolbar.vue b/frontend/app/components/MarkdownEditor/Toolbar.vue
index 16b06cac..08081fa8 100644
--- a/frontend/app/components/MarkdownEditor/Toolbar.vue
+++ b/frontend/app/components/MarkdownEditor/Toolbar.vue
@@ -1,19 +1,21 @@
<template>
<div class="toolbar">
- <button v-for="item in toolbar" :key="item.name" v-html="item.icon" @click="emitAction(item.action)" :title="item.name"></button>
+ <button v-for="item in toolbar" :key="item.name" v-html="item.icon" @click="emitAction(item.action)" :title="item.name" class="btn"></button>
<AppSelect v-model="document.accessibility" :items="accessibilities" placeholder="Access" size="100px" class="entry" v-if="!minimal" />
<AppSelect v-model="document.category" :items="categories" placeholder="Select category" size="300px" class="entry" v-if="!minimal" />
<AppHint text="Tags has been moved down" />
- <!-- TODO: Remove on release 7.4.0 -->
+ <button @click="openModal" class="help"><Icon name="help" :big="true" fill="var(--font-color-light)" /></button>
</div>
</template>
<script setup lang="ts">
import type { Document } from '~/stores';
+import ModalSyntax from './ModalSyntax.vue';
const categories = new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2);
const props = defineProps<{ document: Partial<Document>; minimal?: boolean }>();
const emit = defineEmits(['execute-action']);
const emitAction = (action: string) => emit('execute-action', action, props.document);
+const openModal = () => useModal().add(new Modal(shallowRef(ModalSyntax), {}, () => {}, true));
const accessibilities: ANode[] = [
{
id: 1,
@@ -111,8 +113,9 @@ const toolbar = [
padding: 0.15rem;
color: var(--font-color-dark);
gap: 0 3px;
+ width: 100%;
}
-button {
+.btn {
padding: 4px;
margin: 0;
transform: none;
@@ -130,8 +133,7 @@ button {
}
}
-svg,
-.toolbar:deep(svg) {
+.btn:deep(svg) {
fill: var(--font-color-dark);
width: 24px;
height: 24px;
@@ -145,4 +147,11 @@ input,
.entry {
background-color: var(--bg-color);
}
+
+.help {
+ margin-left: auto;
+ &:hover:deep(svg) {
+ fill: var(--font-color-dark);
+ }
+}
</style>
diff --git a/frontend/app/helpers/icons.ts b/frontend/app/helpers/icons.ts
index 3627fece..32ed8f77 100644
--- a/frontend/app/helpers/icons.ts
+++ b/frontend/app/helpers/icons.ts
@@ -24,11 +24,12 @@ const icons = {
file_parent: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--green);" d="M320-320h200v-200H320v200Zm0-280h480v-200H320v200Zm280 280h200v-200H600v200Zm-280 80q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Z"/></svg>`,
folder: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" style="fill:var(--yellow)"><path style="fill:var(--yellow)" d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640H447l-80-80H160v480l96-320h684L837-217q-8 26-29.5 41.5T760-160H160Zm84-80h516l72-240H316l-72 240Zm0 0 72-240-72 240Zm-84-400v-80 80Z"/></svg>`,
folder_s: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M160-160q-33 0-56.5-23.5T80-240v-400q0-33 23.5-56.5T160-720h240l80-80h320q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm73-280h207v-207L233-440Zm-73-40 160-160H160v160Zm0 120v120h640v-480H520v280q0 33-23.5 56.5T440-360H160Zm280-160Z"/></svg>`,
+ help: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M478-240q21 0 35.5-14.5T528-290q0-21-14.5-35.5T478-340q-21 0-35.5 14.5T428-290q0 21 14.5 35.5T478-240Zm-36-154h74q0-33 7.5-52t42.5-52q26-26 41-49.5t15-56.5q0-56-41-86t-97-30q-57 0-92.5 30T342-618l66 26q5-18 22.5-39t53.5-21q32 0 48 17.5t16 38.5q0 20-12 37.5T506-526q-44 39-54 59t-10 73Zm38 314q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>`,
image: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--green);" d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg>`,
import: `<svg xmlns="http://www.w3.org/2000/svg"viewBox="0 -960 960 960"><path d="M480-800 243-663l237 137 237-137-237-137ZM120-321v-318q0-22 10.5-40t29.5-29l280-161q10-5 19.5-8t20.5-3q11 0 21 3t19 8l280 161q19 11 29.5 29t10.5 40v119q0 17-11.5 28.5T800-480q-17 0-28.5-11.5T760-520v-76L519-457q-19 11-40 11t-40-11L200-596v274l220 128q9 5 14.5 14t5.5 20q0 23-20 34.5t-40 .5L160-252q-19-11-29.5-29T120-321ZM720 0q-83 0-141.5-58.5T520-200q0-83 58.5-141.5T720-400q83 0 141.5 58.5T920-200q0 83-58.5 141.5T720 0ZM480-491Zm220 335-58-58q-6-6-14-6t-14 6q-6 6-6 14t6 14l78 78q6 6 13 8.5t15 2.5q8 0 15-2.5t13-8.5l78-78q6-6 6-14t-6-14q-6-6-14-6t-14 6l-58 58v-144q0-8-6-14t-14-6q-8 0-14 6t-6 14v144Z"/></svg>`,
link: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h120q17 0 28.5 11.5T440-640q0 17-11.5 28.5T400-600H280q-50 0-85 35t-35 85q0 50 35 85t85 35h120q17 0 28.5 11.5T440-320q0 17-11.5 28.5T400-280H280Zm80-160q-17 0-28.5-11.5T320-480q0-17 11.5-28.5T360-520h240q17 0 28.5 11.5T640-480q0 17-11.5 28.5T600-440H360Zm200 160q-17 0-28.5-11.5T520-320q0-17 11.5-28.5T560-360h120q50 0 85-35t35-85q0-50-35-85t-85-35H560q-17 0-28.5-11.5T520-640q0-17 11.5-28.5T560-680h120q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H560Z"/></svg>`,
list: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M160-280q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360h480q17 0 28.5 11.5T680-320q0 17-11.5 28.5T640-280H160Zm80-160q-17 0-28.5-11.5T200-480q0-17 11.5-28.5T240-520h480q17 0 28.5 11.5T760-480q0 17-11.5 28.5T720-440H240Zm80-160q-17 0-28.5-11.5T280-640q0-17 11.5-28.5T320-680h480q17 0 28.5 11.5T840-640q0 17-11.5 28.5T800-600H320Z"/></svg>`,
- logout: `<svg xmlns="http://www.w3.org/2000/svg" style="fill:var(--font-color);" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h280v80H200Zm440-160-55-58 102-102H360v-80h327L585-622l55-58 200 200-200 200Z"/></svg>`,
+ logout: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h280v80H200Zm440-160-55-58 102-102H360v-80h327L585-622l55-58 200 200-200 200Z"/></svg>`,
markdown: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m640-360 120-120-42-43-48 48v-125h-60v125l-48-48-42 43 120 120ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm0 0v-480 480Zm60-120h60v-180h40v120h60v-120h40v180h60v-200q0-17-11.5-28.5T440-600H260q-17 0-28.5 11.5T220-560v200Z"/></svg>`,
new_tab: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"/></svg>`,
pdf: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--green);" d="M280-280h280v-80H280v80Zm0-160h400v-80H280v80Zm0-160h400v-80H280v80Zm-80 480q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>`,
diff --git a/frontend/app/styles/code.scss b/frontend/app/styles/code.scss
index 12683532..43750d5f 100644
--- a/frontend/app/styles/code.scss
+++ b/frontend/app/styles/code.scss
@@ -1,3 +1,11 @@
+code {
+ background: var(--bg-contrast);
+ color: var(--font-color);
+ margin: 2px;
+ padding: 3px;
+ border-radius: 5px;
+}
+
pre code.hljs {
display: block;
overflow-x: auto;
@@ -17,9 +25,12 @@ pre {
width: 100%;
}
+pre>code,
code.hljs {
padding: 0.75em;
text-wrap: wrap;
+ background: #3b4244;
+ color: #fff;
}
.hljs {
diff --git a/frontend/app/styles/components.scss b/frontend/app/styles/components.scss
index 7c1ce5fa..cc7fcacb 100644
--- a/frontend/app/styles/components.scss
+++ b/frontend/app/styles/components.scss
@@ -1,4 +1,9 @@
.modal {
+
+ max-height: 715px;
+ height: 100%;
+ overflow-y: auto;
+
.footer {
margin: 6px 0;
padding: 6px 0 0 0;