From ecdee43e18f6c705ce6f6073ce46d1815d67cac9 Mon Sep 17 00:00:00 2001
From: netlimpopo <95566396+netlimpopo@users.noreply.github.com>
Date: Tue, 30 Dec 2025 02:29:49 +0100
Subject: [PATCH 1/6] Create insert-moc.json
---
insert-moc/insert-moc.json | 10 ++++++++++
1 file changed, 10 insertions(+)
create mode 100644 insert-moc/insert-moc.json
diff --git a/insert-moc/insert-moc.json b/insert-moc/insert-moc.json
new file mode 100644
index 0000000..7621e78
--- /dev/null
+++ b/insert-moc/insert-moc.json
@@ -0,0 +1,10 @@
+{
+ "name": "Insert Table of Contents II (M.O.C. Map of Contents)",
+ "identifier": "insert-table-of-contents-II-map-of-contents",
+ "script": "insert-table-of-contents-II-map-of-contents.qml",
+ "authors": ["@netlimpopo"],
+ "platforms": ["linux", "macos", "windows"],
+ "version": "0.0.1",
+ "minAppVersion": "25.12.07",
+ "description": "This script generates a list of clickable links which map to every single .md note within the active note folder (= "Map of contents (M.O.C.)"). It displays the links in a table format along with the relative filepaths of the files. Furthermore it sorts the links in alphabetical order. \n The difference to the "Table of Contents" script lies in the fact, that the T.O.C script creates links to headings of the same document whereas this M.O.C. script creates references to every single notename in the active note folder.\n Usage \n.
- Select the highest folder hierachy (!).
- Create a new note with an arbitrary name in the highest note hierachy (note level).
- Click the M.O.C button in the script menu. Then the script will overwrite all of the current note content and will insert the linkslist.
\n\n Warning \n Note that all of the content of the selcted note will be replaced by the table of contents link list. Therefore it is essential to create a new note and exclusive use this note for the M.O.C list.\n automatic updates\n In case you rename a note, the markdown links in the M.O.C will be automatically updated too, as QOwnNotes watches all markdownlinks and checks links for necessary updates. \n However, if one creates a new note anywhere, the script must be excecuted again, as it will otherwise not watch for file additions nor will it add a new link to the list.\n Also if you want to move the M.O.C file to a different location, all the links will be updated accordingly thanks to the QOwnNotes logic.
+}
From 32b7a503666aa247d8e4db1eec83f7f1b27c729e Mon Sep 17 00:00:00 2001
From: netlimpopo <95566396+netlimpopo@users.noreply.github.com>
Date: Tue, 30 Dec 2025 02:33:21 +0100
Subject: [PATCH 2/6] Update insert-moc.json
---
insert-moc/insert-moc.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/insert-moc/insert-moc.json b/insert-moc/insert-moc.json
index 7621e78..46a85a3 100644
--- a/insert-moc/insert-moc.json
+++ b/insert-moc/insert-moc.json
@@ -6,5 +6,5 @@
"platforms": ["linux", "macos", "windows"],
"version": "0.0.1",
"minAppVersion": "25.12.07",
- "description": "This script generates a list of clickable links which map to every single .md note within the active note folder (= "Map of contents (M.O.C.)"). It displays the links in a table format along with the relative filepaths of the files. Furthermore it sorts the links in alphabetical order. \n The difference to the "Table of Contents" script lies in the fact, that the T.O.C script creates links to headings of the same document whereas this M.O.C. script creates references to every single notename in the active note folder.\n Usage \n. - Select the highest folder hierachy (!).
- Create a new note with an arbitrary name in the highest note hierachy (note level).
- Click the M.O.C button in the script menu. Then the script will overwrite all of the current note content and will insert the linkslist.
\n\n Warning \n Note that all of the content of the selcted note will be replaced by the table of contents link list. Therefore it is essential to create a new note and exclusive use this note for the M.O.C list.\n automatic updates\n In case you rename a note, the markdown links in the M.O.C will be automatically updated too, as QOwnNotes watches all markdownlinks and checks links for necessary updates. \n However, if one creates a new note anywhere, the script must be excecuted again, as it will otherwise not watch for file additions nor will it add a new link to the list.\n Also if you want to move the M.O.C file to a different location, all the links will be updated accordingly thanks to the QOwnNotes logic.
+ "description": "This script generates a list of clickable links which map to every single .md note within the active note folder (= "Map of contents (M.O.C.)"). It displays the links in a table format along with the relative filepaths of the files. Furthermore it sorts the links in alphabetical order. \n The difference to the "Table of Contents" script lies in the fact, that the T.O.C script creates links to headings of the same document whereas this M.O.C. script creates references to every single notename in the active note folder.\n Usage \n. - Select the highest folder hierachy (!).
- Create a new note with an arbitrary name in the highest note hierachy (note level).
- Click the M.O.C button in the script menu. Then the script will overwrite all of the current note content and will insert the linkslist.
\n\n Warning \n Note that all of the content of the selcted note will be replaced by the table of contents link list. Therefore it is essential to create a new note and exclusive use this note for the M.O.C list.\n automatic updates\n In case you rename a note, the markdown links in the M.O.C will be automatically updated too, as QOwnNotes watches all markdownlinks and checks links for necessary updates. \n However, if one creates a new note anywhere, the script must be excecuted again, as it will otherwise not watch for file additions nor will it add a new link to the list.\n Also if you want to move the M.O.C file to a different location, all the links will be updated accordingly thanks to the QOwnNotes logic."
}
From 5d250ce04884baead196e72d59bb44317a2fdb5d Mon Sep 17 00:00:00 2001
From: netlimpopo <95566396+netlimpopo@users.noreply.github.com>
Date: Tue, 30 Dec 2025 02:34:41 +0100
Subject: [PATCH 3/6] Create insert-moc.qml
---
insert-moc/insert-moc.qml | 56 +++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 insert-moc/insert-moc.qml
diff --git a/insert-moc/insert-moc.qml b/insert-moc/insert-moc.qml
new file mode 100644
index 0000000..3509aa8
--- /dev/null
+++ b/insert-moc/insert-moc.qml
@@ -0,0 +1,56 @@
+import QtQml 2.2
+import QOwnNotesTypes 1.0
+
+Script {
+ function init() {
+ // Register custom action for MOC index generation
+ script.registerCustomAction("indexpage", "Generate MOC", "indexpage");
+ }
+
+ function customActionInvoked(action) {
+ if (action !== "indexpage") {
+ return;
+ }
+
+ var currentNote = script.currentNote;
+ var noteIds = script.fetchNoteIdsByNoteTextPart(""); // get all note IDs
+
+ // Build each link line and collect into array
+ var listedLinks = [];
+ for (var i = 0; i < noteIds.length; i++) {
+ var noteId = noteIds[i];
+ var noteObj = script.fetchNoteById(noteId);
+ var name = noteObj.name;
+ var fullPath = noteObj.fullNoteFilePath;
+ var parts = fullPath.split('.');
+ var ext = parts[parts.length - 1];
+ var relDir = noteObj.relativeNoteFileDirPath;
+
+ // Construct filePath and encoded path
+ var filePath = relDir && relDir.length > 0
+ ? relDir + "/" + name + "." + ext
+ : name + "." + ext;
+ var rawLink = (relDir && relDir.length > 0
+ ? relDir + "/" + name
+ : name);
+ var encoded = encodeURIComponent(rawLink)
+ .replace(/%2F/g, "/")
+ .replace(/%2E/g, ".") + "." + ext;
+
+ // Format line
+ var line = "|" + filePath + " | ---> [" + name + "." + ext + "](" + encoded + ")| ";
+ listedLinks.push(line);
+ }
+
+ // Sort lines alphabetically
+ listedLinks.sort();
+
+ // Assemble new note text
+ var noteTextstring = "# Map of Content \n\n|path |filelink | \n|---|---| \n" + listedLinks.join("\n") + "\n";
+
+ // Replace entire note content
+ script.noteTextEditSelectAll();
+ script.noteTextEditWrite(noteTextstring);
+ script.log("MOC index generated and sorted successfully.");
+ }
+}
From e76ecccc46389ef15591ec7ba4c439742025d143 Mon Sep 17 00:00:00 2001
From: netlimpopo <95566396+netlimpopo@users.noreply.github.com>
Date: Tue, 30 Dec 2025 03:02:14 +0100
Subject: [PATCH 4/6] Update insert-moc.qml
---
insert-moc/insert-moc.qml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/insert-moc/insert-moc.qml b/insert-moc/insert-moc.qml
index 3509aa8..04d3ad2 100644
--- a/insert-moc/insert-moc.qml
+++ b/insert-moc/insert-moc.qml
@@ -4,7 +4,7 @@ import QOwnNotesTypes 1.0
Script {
function init() {
// Register custom action for MOC index generation
- script.registerCustomAction("indexpage", "Generate MOC", "indexpage");
+ script.registerCustomAction("MOC", "Generate MOC", "MOC");
}
function customActionInvoked(action) {
From e6092be4d28ea65482635b1f91eb0608904a7730 Mon Sep 17 00:00:00 2001
From: netlimpopo <95566396+netlimpopo@users.noreply.github.com>
Date: Tue, 30 Dec 2025 16:50:00 +0100
Subject: [PATCH 5/6] Update and rename insert-moc.json to info.json
- changed identifier to "insert-moc"
- changed script to insert-moc.qml
- updated the minAppVersion to 25.12.7
- extended the description.
---
insert-moc/{insert-moc.json => info.json} | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
rename insert-moc/{insert-moc.json => info.json} (55%)
diff --git a/insert-moc/insert-moc.json b/insert-moc/info.json
similarity index 55%
rename from insert-moc/insert-moc.json
rename to insert-moc/info.json
index 46a85a3..baa06a9 100644
--- a/insert-moc/insert-moc.json
+++ b/insert-moc/info.json
@@ -1,10 +1,10 @@
{
"name": "Insert Table of Contents II (M.O.C. Map of Contents)",
- "identifier": "insert-table-of-contents-II-map-of-contents",
- "script": "insert-table-of-contents-II-map-of-contents.qml",
+ "identifier": "insert-moc",
+ "script": "insert-moc.qml",
"authors": ["@netlimpopo"],
"platforms": ["linux", "macos", "windows"],
"version": "0.0.1",
- "minAppVersion": "25.12.07",
- "description": "This script generates a list of clickable links which map to every single .md note within the active note folder (= "Map of contents (M.O.C.)"). It displays the links in a table format along with the relative filepaths of the files. Furthermore it sorts the links in alphabetical order. \n The difference to the "Table of Contents" script lies in the fact, that the T.O.C script creates links to headings of the same document whereas this M.O.C. script creates references to every single notename in the active note folder.\n Usage \n. - Select the highest folder hierachy (!).
- Create a new note with an arbitrary name in the highest note hierachy (note level).
- Click the M.O.C button in the script menu. Then the script will overwrite all of the current note content and will insert the linkslist.
\n\n Warning \n Note that all of the content of the selcted note will be replaced by the table of contents link list. Therefore it is essential to create a new note and exclusive use this note for the M.O.C list.\n automatic updates\n In case you rename a note, the markdown links in the M.O.C will be automatically updated too, as QOwnNotes watches all markdownlinks and checks links for necessary updates. \n However, if one creates a new note anywhere, the script must be excecuted again, as it will otherwise not watch for file additions nor will it add a new link to the list.\n Also if you want to move the M.O.C file to a different location, all the links will be updated accordingly thanks to the QOwnNotes logic."
+ "minAppVersion": "25.12.7",
+ "description": "This script generates a list of clickable links which map to every single .md note within the active note folder (= "Map of contents (M.O.C.)"). It displays the links in a table format along with the relative filepaths of the files. Furthermore it sorts the links in alphabetical order. \n The difference to the "Table of Contents" script lies in the fact, that the T.O.C script creates links to headings of the same document whereas this M.O.C. script creates references to every single notename in the active note folder.\n Usage \n. - Select the highest folder hierachy (!).
- Create a new note with an arbitrary name in the highest note hierachy (note level).
- Click the M.O.C button in the script menu. Then the script will overwrite all of the current note content and will insert the linkslist.
\n\n Warning \n Note that all of the content of the selcted note will be replaced by the table of contents link list. Therefore it is essential to create a new note and exclusively use this note for the M.O.C list.\n automatic updates\n In case you rename a note, the markdown links in the M.O.C will be automatically updated too, as QOwnNotes watches all markdownlinks and checks links for necessary updates. \n However, if one creates a new note anywhere, the script must be excecuted again, as it will otherwise not watch for file additions nor will it add a new link to the list.\n Also if you want to move the M.O.C file to a different location, all the links will be updated accordingly thanks to the QOwnNotes logic. \n An M.O.C. can act as a navitational site (especially when all files are exported as static .html pages) and provide an overview of all available notes. The idea is strongly influenced by the Obsidian plugin 'Waypoint' see Waypoint Obsidian. "
}
From 2ba3ea896bc3aaa827cba859e8c1f651f98a17a9 Mon Sep 17 00:00:00 2001
From: netlimpopo <95566396+netlimpopo@users.noreply.github.com>
Date: Tue, 30 Dec 2025 21:04:45 +0100
Subject: [PATCH 6/6] Update info.json
- Removed `"` and replaced it with `'`to give the .json a correct form.
- I did not delete the `"Insert"`, as in the very similar "Table of Contents" script "name" descriptor is called:
- "Insert Table of Contents (TOC)"
- Mine: "Insert Table of Contents II (M.O.C. Map of contents)"
If you really want me to I will will remove the name. As a user I just think it is convenient that those 2 scripts are just beneth each other in the script repository menu in QN.
---
insert-moc/info.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/insert-moc/info.json b/insert-moc/info.json
index baa06a9..a651df5 100644
--- a/insert-moc/info.json
+++ b/insert-moc/info.json
@@ -6,5 +6,5 @@
"platforms": ["linux", "macos", "windows"],
"version": "0.0.1",
"minAppVersion": "25.12.7",
- "description": "This script generates a list of clickable links which map to every single .md note within the active note folder (= "Map of contents (M.O.C.)"). It displays the links in a table format along with the relative filepaths of the files. Furthermore it sorts the links in alphabetical order. \n The difference to the "Table of Contents" script lies in the fact, that the T.O.C script creates links to headings of the same document whereas this M.O.C. script creates references to every single notename in the active note folder.\n Usage \n. - Select the highest folder hierachy (!).
- Create a new note with an arbitrary name in the highest note hierachy (note level).
- Click the M.O.C button in the script menu. Then the script will overwrite all of the current note content and will insert the linkslist.
\n\n Warning \n Note that all of the content of the selcted note will be replaced by the table of contents link list. Therefore it is essential to create a new note and exclusively use this note for the M.O.C list.\n automatic updates\n In case you rename a note, the markdown links in the M.O.C will be automatically updated too, as QOwnNotes watches all markdownlinks and checks links for necessary updates. \n However, if one creates a new note anywhere, the script must be excecuted again, as it will otherwise not watch for file additions nor will it add a new link to the list.\n Also if you want to move the M.O.C file to a different location, all the links will be updated accordingly thanks to the QOwnNotes logic. \n An M.O.C. can act as a navitational site (especially when all files are exported as static .html pages) and provide an overview of all available notes. The idea is strongly influenced by the Obsidian plugin 'Waypoint' see Waypoint Obsidian. "
+ "description": "This script generates a list of clickable links which map to every single .md note within the active note folder (= 'Map of contents (M.O.C.)'). It displays the links in a table format along with the relative filepaths of the files. Furthermore it sorts the links in alphabetical order. \n The difference to the 'Table of Contents' script lies in the fact, that the T.O.C script creates links to headings of the same document whereas this M.O.C. script creates references to every single notename in the active note folder.\n Usage \n. - Select the highest folder hierachy (!).
- Create a new note with an arbitrary name in the highest note hierachy (note level).
- Click the M.O.C button in the script menu. Then the script will overwrite all of the current note content and will insert the linkslist.
\n\n Warning \n Note that all of the content of the selcted note will be replaced by the table of contents link list. Therefore it is essential to create a new note and exclusively use this note for the M.O.C list.\n automatic updates\n In case you rename a note, the markdown links in the M.O.C will be automatically updated too, as QOwnNotes watches all markdownlinks and checks links for necessary updates. \n However, if one creates a new note anywhere, the script must be excecuted again, as it will otherwise not watch for file additions nor will it add a new link to the list.\n Also if you want to move the M.O.C file to a different location, all the links will be updated accordingly thanks to the QOwnNotes logic. \n An M.O.C. can act as a navitational site (especially when all files are exported as static .html pages) and provide an overview of all available notes. The idea is strongly influenced by the Obsidian plugin 'Waypoint' see Waypoint Obsidian. "
}