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.

Document themes and add Alexandir & Latex themes :tada: (beta)

Smaug67397fff4e4d8deb
diff --git a/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue b/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue
index 8562360b..42025ef0 100644
--- a/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue
+++ b/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue
@@ -7,7 +7,7 @@
<input placeholder="Description" class="description" v-model="document.description" v-if="!minimal" />
<div class="markdown" ref="container">
<div ref="editorContainer" class="codemirror-editor" @scroll="syncScroll" />
- <div v-if="showPreview" class="markdown-preview document-theme" ref="markdownPreview" v-html="document.content_html"></div>
+ <div v-if="showPreview" :class="['markdown-preview', `${usePreferences().get('theme')}-theme`]" ref="markdownPreview" v-html="document.content_html"></div>
</div>
</div>
</div>
diff --git a/frontend/app/composables/Preferences.ts b/frontend/app/composables/Preferences.ts
index 2859d454..642eeced 100644
--- a/frontend/app/composables/Preferences.ts
+++ b/frontend/app/composables/Preferences.ts
@@ -1,14 +1,14 @@
// composables/usePreferences.ts
import { ref, computed, watch } from 'vue';
-export type PreferenceKey = 'printMode' | 'darkMode' | 'hideTOC' | 'compactMode' | 'hideSidebarRessources' | 'normalizeFileIcons' | 'datatableItemsCount' | 'view_dock' | 'primaryColor' | 'docSize' | 'sidebarCollapseItems';
+export type PreferenceKey = keyof typeof DEFAULT_PREFERENCES;
export interface Preference {
key: PreferenceKey;
value: any;
}
-const DEFAULT_PREFERENCES: Record<PreferenceKey, any> = {
+const DEFAULT_PREFERENCES = {
printMode: false,
darkMode: false,
hideTOC: false,
@@ -20,6 +20,7 @@ const DEFAULT_PREFERENCES: Record<PreferenceKey, any> = {
primaryColor: 0,
docSize: 1, // 0 = small, 1 = large
sidebarCollapseItems: [],
+ theme: 'alexandrie',
};
const preferences = ref<Preference[]>(loadPreferences());
diff --git a/frontend/app/helpers/markdown/constants.ts b/frontend/app/helpers/markdown/constants.ts
index 500ae4e8..de6049b8 100644
--- a/frontend/app/helpers/markdown/constants.ts
+++ b/frontend/app/helpers/markdown/constants.ts
@@ -4,7 +4,7 @@ const svg_warning = `<svg style="align-self: center;" class="svg-icon" viewBox="
function containerOpen(title: string, logo: string, color: string) {
return `<div class="markdown-container">
<strong style="display: inline-flex; align-items: baseline;" class="${color} title">
- ${logo}${title}</strong>`;
+ ${logo}${title}</strong><div class="markdown-container-content">`;
}
export { svg_info, svg_warning, containerOpen };
diff --git a/frontend/app/helpers/markdown/container.ts b/frontend/app/helpers/markdown/container.ts
index ef44be0b..604f06f4 100644
--- a/frontend/app/helpers/markdown/container.ts
+++ b/frontend/app/helpers/markdown/container.ts
@@ -31,9 +31,9 @@ function createContainer(klass: string, defaultTitle: string, md: MarkdownIt): C
if (klass === 'details') {
return `<details class="${klass} custom-block no-print"><summary>${title}</summary>\n`;
}
- return `<div class="${klass} custom-block"><p class="custom-block-title">${title}</p>\n`;
+ return `<div class="${klass} custom-block"><p class="custom-block-title">${title}</p><div class="custom-block-content">\n`;
} else {
- return klass === 'details' ? `</details>\n` : `</div>\n`;
+ return klass === 'details' ? `</details>\n` : `</div></div>\n`;
}
},
},
diff --git a/frontend/app/helpers/markdown/containers-svg.ts b/frontend/app/helpers/markdown/containers-svg.ts
index 2e6868c9..077ba158 100644
--- a/frontend/app/helpers/markdown/containers-svg.ts
+++ b/frontend/app/helpers/markdown/containers-svg.ts
@@ -15,7 +15,7 @@ export const containerSvg = (md: MarkdownIt) => {
return containerOpen(m[1], svg_info, 'red');
} else {
// closing tag
- return '</div>\n';
+ return '</div></div>\n';
}
},
});
@@ -31,7 +31,7 @@ export const containerSvg = (md: MarkdownIt) => {
return containerOpen(m[1], svg_info, 'blue');
} else {
// closing tag
- return '</div>\n';
+ return '</div></div>\n';
}
},
});
@@ -47,7 +47,7 @@ export const containerSvg = (md: MarkdownIt) => {
return containerOpen(m[1], svg_info, 'teal');
} else {
// closing tag
- return '</div>\n';
+ return '</div></div>\n';
}
},
});
@@ -63,7 +63,7 @@ export const containerSvg = (md: MarkdownIt) => {
return containerOpen(m[1], svg_warning, 'yellow');
} else {
// closing tag
- return '</div>\n';
+ return '</div></div>\n';
}
},
});
@@ -78,7 +78,7 @@ export const containerSvg = (md: MarkdownIt) => {
return containerOpen(m.slice(1).join(' '), svg_info, m[0]?.split('-')[1]);
} else {
// closing tag
- return '</div>\n';
+ return '</div></div>\n';
}
},
});
diff --git a/frontend/app/pages/dashboard/docs/[id].vue b/frontend/app/pages/dashboard/docs/[id].vue
index 8165f14a..2dd63f12 100644
--- a/frontend/app/pages/dashboard/docs/[id].vue
+++ b/frontend/app/pages/dashboard/docs/[id].vue
@@ -3,7 +3,7 @@
<div style="display: flex; justify-content: space-between">
<div :style="{ width: '100%', margin: 'auto', maxWidth: usePreferences().get('docSize') == 0 ? '980px' : '780px' }">
<DocumentCardHeader :doc="article" style="margin-bottom: 20px" />
- <article class="document-theme" style="max-width: 100%" ref="element" v-html="article.content_html"></article>
+ <article :class="`${usePreferences().get('theme')}-theme`" style="max-width: 100%" ref="element" v-html="article.content_html"></article>
<DocumentCardFooter :document="article" :next="next" :previous="previous" />
</div>
<div v-if="!isTablet() && !preferencesStore.get('hideTOC')" class="toc"><TableOfContent :doc="article" :element="element" class="toc" style="width: 400px" /></div>
diff --git a/frontend/app/pages/dashboard/settings/_views/preferences.vue b/frontend/app/pages/dashboard/settings/_views/preferences.vue
index 2ee994b7..f642f9ab 100644
--- a/frontend/app/pages/dashboard/settings/_views/preferences.vue
+++ b/frontend/app/pages/dashboard/settings/_views/preferences.vue
@@ -52,9 +52,9 @@ interface ColorOption extends BaseOption {
interface SelectOption extends BaseOption {
type: 'select';
- value: number;
- choices: { label: string; value: number }[];
- onChange?: (value: number) => void;
+ value: number | string;
+ choices: { label: string; value: number | string }[];
+ onChange?: (value: number | string) => void;
}
type Option = ToggleOption | SelectOption | ColorOption;
@@ -107,6 +107,16 @@ const options = ref<{ label: string; options: Option[] }[]>([
{ label: 'Minimal', value: 1 },
],
},
+ {
+ label: 'Theme',
+ type: 'select',
+ value: preferencesStore.get('theme'),
+ storageKey: 'theme',
+ choices: [
+ { label: 'Alexandrie', value: 'alexandrie' },
+ { label: 'Latex style', value: 'latex' },
+ ],
+ },
],
},
{
@@ -184,13 +194,6 @@ label {
flex: 1;
}
-select {
- padding: 0.25rem 0.5rem;
- border-radius: 4px;
- border: 1px solid #ccc;
- background: var(--bg-contrast);
- font-size: 0.95rem;
-}
.reset {
margin-top: 2rem;
}
diff --git a/frontend/app/styles/document-theme.scss b/frontend/app/styles/document-theme.scss
index 9a5c73a6..826808a2 100644
--- a/frontend/app/styles/document-theme.scss
+++ b/frontend/app/styles/document-theme.scss
@@ -1,6 +1,6 @@
@use "./_variables.scss" as *;
-.document-theme {
+.alexandrie-theme {
font-family: "Poppins", sans-serif;
max-width: 100%;
@@ -11,4 +11,88 @@
text-decoration: underline;
}
}
+}
+
+@import url('https://fonts.googleapis.com/css2?family=Libertinus+Math&display=swap');
+@import url('https://fonts.cdnfonts.com/css/latin-modern-roman');
+
+.latex-theme {
+ font-family: "Latin Modern Roman", serif;
+ font-size: 18px;
+ max-width: 100%;
+
+ h1 {
+ font-size: 1.5em;
+ }
+
+ h2 {
+ font-size: 1.3em;
+ margin: 1em 0;
+ }
+
+ p {
+ padding: 0.5em 0;
+ }
+
+ .header-anchor {
+ display: none;
+ }
+
+ .markdown-container {
+ display: flex;
+ background-color: transparent;
+ gap: 1rem;
+ border: none;
+ padding: 0;
+ margin: 0.5em 0;
+
+ .title {
+ border-right: 1px solid var(--font-color);
+ color: var(--font-color-dark);
+ padding: 5px 12px;
+ max-width: 150px;
+
+ svg {
+ display: none;
+ }
+ }
+ }
+
+ .custom-block {
+ background-color: transparent;
+ border: none;
+ padding: 0;
+ margin: 2em 0;
+ display: flex;
+ font-size: 16px;
+
+ .custom-block-title {
+ border-right: 1px solid var(--font-color);
+ font-weight: bold;
+ padding: 5px 12px;
+ color: var(--font-color-dark);
+ }
+
+
+
+ .custom-block-content {
+ flex: 1;
+ padding: 0 0.5em;
+ color: var(--font-color);
+
+ p {
+ padding: 0 0.5em;
+ }
+ }
+ }
+
+ .katex {
+ font-size: 18px;
+
+ .text {
+ font-family: 'Libertinus Math', serif;
+ font-size: 14px;
+ }
+ }
+
}
\ No newline at end of file