Skip to content

Commit 3511576

Browse files
committed
insert-toc: allow omitting the TOC heading (#295)
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent 2ea2833 commit 3511576

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎insert-toc/CHANGELOG.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Changelog
2+
3+
## 0.0.4 - 2026-08-24
4+
5+
- Allow the table of contents title and its surrounding whitespace to be omitted by clearing the title setting ([#295](https://github.com/qownnotes/scripts/issues/295)).
6+
7+
## 0.0.3 - 2018-08-21
8+
9+
- Preserve numbers when generating section links.
10+
11+
## 0.0.2 - 2018-08-20
12+
13+
- Add optional links to sections.
14+
15+
## 0.0.1 - 2018-01-26
16+
17+
- Initial release.

‎insert-toc/info.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"script": "insert-toc.qml",
55
"authors": ["@flopp", "@toindev"],
66
"platforms": ["linux", "macos", "windows"],
7-
"version": "0.0.3",
7+
"version": "0.0.4",
88
"minAppVersion": "17.06.2",
99
"description": "This script scans the current note for headlines, generates a table of contents, and inserts a the TOC into the note."
1010
}

‎insert-toc/insert-toc.qml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ Script {
3030
var toc = extractTOC(lines);
3131
toc = normalizeDepths(toc);
3232

33-
script.noteTextEditWrite("\n" + tocTitle + "\n\n");
33+
if (tocTitle !== "") {
34+
script.noteTextEditWrite("\n" + tocTitle + "\n\n");
35+
}
3436
var indexByDepth = {};
3537
for (var n = 0; n < toc.length; n++) {
3638
indexByDepth[toc[n].depth] = 0;

0 commit comments

Comments
 (0)