This is initial "demo" document provided by TriliumNext by default to
showcase some of its features and also give you some ideas how you might
structure your notes. You can play with it, modify note content and tree
structure as you wish.
For larger pieces of code it is better to use a code note, which uses
a fully-fledged code editor (CodeMirror). For an example of a code note,
see Custom request handler.
Trusted timestamping is the process of securely keeping
track of the creation and modification time of a document. Security here
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/18 - Monday.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/18 - Monday.html
index ae490681e..3722a62c0 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/18 - Monday.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/18 - Monday.html
@@ -16,6 +16,7 @@
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Chichén Itzá, Mexico.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Chichén Itzá, Mexico.html
index ab44bd638..3992ceed9 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Chichén Itzá, Mexico.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Chichén Itzá, Mexico.html
@@ -24,14 +24,17 @@
[1]
+
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Christ the Redeemer, Brazil.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Christ the Redeemer, Brazil.html
index 3e1f1e905..cbaae70da 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Christ the Redeemer, Brazil.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Christ the Redeemer, Brazil.html
@@ -26,13 +26,16 @@
been brought to its knees.[1]
+
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Machu Picchu, Peru.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Machu Picchu, Peru.html
index 5e9817e5b..929103047 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Machu Picchu, Peru.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Machu Picchu, Peru.html
@@ -22,13 +22,16 @@
around 1450 in polished drystone walls.[1]
+
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Petra, Jordan.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Petra, Jordan.html
index 1396c2691..55e0adafa 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Petra, Jordan.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Petra, Jordan.html
@@ -23,13 +23,16 @@
by earthquakes.[1]
+
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Colosseum, Rome, Italy.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Colosseum, Rome, Italy.html
index 650a6623c..c9abd680d 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Colosseum, Rome, Italy.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Colosseum, Rome, Italy.html
@@ -26,14 +26,17 @@
[1]
+
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Great Wall of China.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Great Wall of China.html
index 1f5d5886f..ccedb8388 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Great Wall of China.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Great Wall of China.html
@@ -23,14 +23,17 @@
[1]
+
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Taj Mahal, India.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Taj Mahal, India.html
index 0d692392a..755184be0 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Taj Mahal, India.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Taj Mahal, India.html
@@ -23,13 +23,16 @@
the complex.[1]
+
Please note that this is meant as scripting example only and feature/bug
support is very limited.
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Done/Buy a board game for Alice.html b/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Done/Buy a board game for Alice.html
index 9cda89645..65b1819f2 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Done/Buy a board game for Alice.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Done/Buy a board game for Alice.html
@@ -18,6 +18,7 @@
width="209" height="300">
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Locations/mall/Buy some book for Bob/Maybe Black Swan.html b/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Locations/mall/Buy some book for Bob/Maybe Black Swan.html
index ba291c1ae..51831b17f 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Locations/mall/Buy some book for Bob/Maybe Black Swan.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Locations/mall/Buy some book for Bob/Maybe Black Swan.html
@@ -14,6 +14,7 @@
The Black Swan: The Impact of the Highly Improbable is
a 2007 book by author and former options trader
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting.html b/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting.html
index aaa6cd1ad..55c1364be 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting.html
@@ -25,6 +25,7 @@
and Apple'smacOS (formerly
OS X). A version is also available for Windows 10.
As a "login shell", Bash reads and sets (executes) the user's profile
from /etc/profile and one of ~/.bash_profile, ~/.bash_login, or ~/.profile
(in that order, using the first one that's readable!).
@@ -23,6 +24,7 @@
that only make sense for the initial user login. That's why all UNIX® shells
have (should have) a "login" mode.
Methods to start Bash as a login shell:
+
the first character of argv[0] is - (a hyphen): traditional UNIX® shells
@@ -31,17 +33,20 @@
When Bash starts as an interactive non-login shell, it reads and executes
commands from ~/.bashrc. This file should contain, for example, aliases,
since they need to be defined in every shell as they're not inherited from
@@ -51,11 +56,13 @@
The classic way to have a system-wide rc file is to source /etc/bashrc
from every user's ~/.bashrc.
Methods to test for interactive-shell mode:
+
the special parameter $- contains the letter i (lowercase I)
Related switches:
+
-i forces the interactive mode
@@ -65,6 +72,7 @@
~/.bashrc)
SH mode
+
When Bash starts in SH compatiblity mode, it tries to mimic the startup
behaviour of historical versions of sh as closely as possible, while conforming
to the POSIX® standard as well. The profile files read are /etc/profile
@@ -74,6 +82,7 @@
file.
#!/bin/bash
# This script opens 4 terminal windows.
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Tech/Node.js/Overview/Platform architecture.html b/apps/edit-docs/demo/root/Trilium Demo/Tech/Node.js/Overview/Platform architecture.html
index 1a977bccc..4b51ab5be 100644
--- a/apps/edit-docs/demo/root/Trilium Demo/Tech/Node.js/Overview/Platform architecture.html
+++ b/apps/edit-docs/demo/root/Trilium Demo/Tech/Node.js/Overview/Platform architecture.html
@@ -20,6 +20,7 @@
href="https://en.wikipedia.org/wiki/Node.js#cite_note-b1-31">[31]Developers can create scalable servers without using threading,
by using a simplified model of event-driven programming that
uses callbacks to signal the completion of a task.[31]
+
diff --git a/apps/server/spec/db/document.db b/apps/server/spec/db/document.db
index c1000f7f9..50b477ea7 100644
Binary files a/apps/server/spec/db/document.db and b/apps/server/spec/db/document.db differ
diff --git a/apps/server/src/assets/db/demo.zip b/apps/server/src/assets/db/demo.zip
index 8a0d61779..322fbe7de 100644
Binary files a/apps/server/src/assets/db/demo.zip and b/apps/server/src/assets/db/demo.zip differ
diff --git a/apps/server/src/routes/api/options.ts b/apps/server/src/routes/api/options.ts
index c69f7568f..42d4fb110 100644
--- a/apps/server/src/routes/api/options.ts
+++ b/apps/server/src/routes/api/options.ts
@@ -57,6 +57,7 @@ const ALLOWED_OPTIONS = new Set([
"headingStyle",
"autoCollapseNoteTree",
"autoReadonlySizeText",
+ "customDateTimeFormat",
"autoReadonlySizeCode",
"overrideThemeFonts",
"dailyBackupEnabled",
diff --git a/apps/server/src/share/routes.spec.ts b/apps/server/src/share/routes.spec.ts
index 3cde4be23..987d1b12a 100644
--- a/apps/server/src/share/routes.spec.ts
+++ b/apps/server/src/share/routes.spec.ts
@@ -33,4 +33,13 @@ describe("Share API test", () => {
expect(cannotSetHeadersCount).toBe(0);
});
+ it("renders custom share template", async () => {
+ const response = await supertest(app)
+ .get("/share/pQvNLLoHcMwH")
+ .expect(200);
+ expect(cannotSetHeadersCount).toBe(0);
+ expect(response.text).toContain("Content Start");
+ expect(response.text).toContain("Content End");
+ });
+
});
diff --git a/apps/server/src/share/routes.ts b/apps/server/src/share/routes.ts
index ee36621ed..614cd2101 100644
--- a/apps/server/src/share/routes.ts
+++ b/apps/server/src/share/routes.ts
@@ -16,6 +16,7 @@ import type SBranch from "./shaca/entities/sbranch.js";
import type SAttachment from "./shaca/entities/sattachment.js";
import utils, { isDev, safeExtractMessageAndStackFromError } from "../services/utils.js";
import options from "../services/options.js";
+import { t } from "i18next";
function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {
if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {
@@ -135,7 +136,7 @@ function renderImageAttachment(image: SNote, res: Response, attachmentName: stri
}
function register(router: Router) {
- function renderNote(note: SNote, req: Request, res: Response) {
+ async function renderNote(note: SNote, req: Request, res: Response) {
if (!note) {
console.log("Unable to find note ", note);
res.status(404).render("share/404");
@@ -167,7 +168,8 @@ function register(router: Router) {
subRoot,
assetPath: isDev ? assetPath : `../${assetPath}`,
appPath: isDev ? appPath : `../${appPath}`,
- showLoginInShareTheme
+ showLoginInShareTheme,
+ t
};
let useDefaultView = true;
@@ -182,7 +184,7 @@ function register(router: Router) {
// EJS caches the result of this so we don't need to pre-cache
const includer = (path: string) => {
const childNote = templateNote.children.find((n) => path === n.title);
- if (!childNote) throw new Error("Unable to find child note.");
+ if (!childNote) throw new Error(`Unable to find child note: ${path}.`);
if (childNote.type !== "code" || childNote.mime !== "application/x-ejs") throw new Error("Incorrect child note type.");
const template = childNote.getContent();
@@ -195,11 +197,10 @@ function register(router: Router) {
try {
const content = templateNote.getContent();
if (typeof content === "string") {
- import("ejs").then((ejs) => {
- const ejsResult = ejs.render(content, opts, { includer });
- res.send(ejsResult);
- useDefaultView = false; // Rendering went okay, don't use default view
- });
+ const ejs = await import("ejs");
+ const ejsResult = ejs.render(content, opts, { includer });
+ res.send(ejsResult);
+ useDefaultView = false; // Rendering went okay, don't use default view
}
} catch (e: unknown) {
const [errMessage, errStack] = safeExtractMessageAndStackFromError(e);
diff --git a/packages/ckeditor5/src/icons/date-time.svg b/packages/ckeditor5/src/icons/date-time.svg
new file mode 100644
index 000000000..8e8907da6
--- /dev/null
+++ b/packages/ckeditor5/src/icons/date-time.svg
@@ -0,0 +1,12 @@
+
+
\ No newline at end of file
diff --git a/packages/ckeditor5/src/plugins.ts b/packages/ckeditor5/src/plugins.ts
index 39932ef6d..3310493c0 100644
--- a/packages/ckeditor5/src/plugins.ts
+++ b/packages/ckeditor5/src/plugins.ts
@@ -5,6 +5,7 @@ import UploadimagePlugin from "./plugins/uploadimage.js";
import ItalicAsEmPlugin from "./plugins/italic_as_em.js";
import StrikethroughAsDel from "./plugins/strikethrough_as_del.js";
import InternalLinkPlugin from "./plugins/internallink.js";
+import InsertDateTimePlugin from "./plugins/insert_date_time.js";
import ReferenceLink from "./plugins/referencelink.js";
import RemoveFormatLinksPlugin from "./plugins/remove_format_links.js";
import IndentBlockShortcutPlugin from "./plugins/indent_block_shortcut.js";
@@ -36,6 +37,7 @@ const TRILIUM_PLUGINS: typeof Plugin[] = [
ItalicAsEmPlugin,
StrikethroughAsDel,
InternalLinkPlugin,
+ InsertDateTimePlugin,
RemoveFormatLinksPlugin,
IndentBlockShortcutPlugin,
MarkdownImportPlugin,
diff --git a/packages/ckeditor5/src/plugins/insert_date_time.ts b/packages/ckeditor5/src/plugins/insert_date_time.ts
new file mode 100644
index 000000000..e1417dbe7
--- /dev/null
+++ b/packages/ckeditor5/src/plugins/insert_date_time.ts
@@ -0,0 +1,31 @@
+import { ButtonView, Plugin } from 'ckeditor5';
+import dateTimeIcon from '../icons/date-time.svg?raw';
+
+export default class InsertDateTimePlugin extends Plugin {
+ init() {
+ const editor = this.editor;
+
+ editor.ui.componentFactory.add('dateTime', locale => {
+ const view = new ButtonView( locale );
+
+ view.set( {
+ label: 'Date time',
+ icon: dateTimeIcon,
+ tooltip: true
+ } );
+
+ // enable internal link only if the editor is not read only
+ view.bind('isEnabled').to(editor, 'isReadOnly', isReadOnly => !isReadOnly);
+
+ view.on('execute', () => {
+ const editorEl = editor.editing.view.getDomRoot();
+ const component = glob.getComponentByEl(editorEl);
+
+ component.triggerCommand('insertDateTimeToText');
+ editor.editing.view.focus();
+ } );
+
+ return view;
+ });
+ }
+}
\ No newline at end of file
diff --git a/packages/commons/src/lib/options_interface.ts b/packages/commons/src/lib/options_interface.ts
index 19125d125..32f731936 100644
--- a/packages/commons/src/lib/options_interface.ts
+++ b/packages/commons/src/lib/options_interface.ts
@@ -47,6 +47,7 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions