@@ -88,14 +88,20 @@ let p = dv.pages(filter_page)
88
88
{
89
89
const headings = cache.headings; // get headings from cache
90
90
91
+ if ( typeof headings === 'undefined') {
92
+ dv.el("div", '⭕ No Subheaders Found', { cls: "toc_results_none_subheader" });
93
+ dv.el("div", "<br />");
94
+ return;
95
+ }
96
+
91
97
if (headings)
92
98
{
93
99
const houtput = headings.slice(0) // exclude the first heading
94
100
.filter(h => h.level <= 6)
95
101
.map(h =>
96
102
{
97
- var file_head = h.heading
98
- var header_skip = file_head.replace(/ /g,"_").toLowerCase();
103
+ let file_head = h.heading
104
+ const header_skip = file_head.replace(/ /g,"_").toLowerCase();
99
105
if (header_skip === "table_of_contents" || header_skip === "toc")
100
106
{
101
107
return ""
@@ -104,13 +110,13 @@ let p = dv.pages(filter_page)
104
110
count++;
105
111
106
112
// Determine indentation based on heading level
107
- let indent = " ".repeat(h.level);
108
- var file_name = p.file.name;
113
+ let indent = " ".repeat(h.level);
114
+ const file_name = p.file.name;
109
115
110
116
// remove backticks and tag symbols
111
- var file_head = file_head.replace(/` / g, ' ' );
112
- var file_head = file_head .replace (/ #/ g , ' ' );
113
- var file_title = h .heading .split (' #' )[0 ];
117
+ file_head = file_head.replace(/` / g, ' ' );
118
+ file_head = file_head .replace (/ #/ g , ' ' );
119
+ const file_title = h .heading .split (' #' )[0 ];
114
120
115
121
let objLink = " [[" + file_name + " #" + file_head + " |" + file_title + " ]]" ;
116
122
@@ -127,7 +133,7 @@ let p = dv.pages(filter_page)
127
133
else if ( h .level == 6 )
128
134
return indent + " - <span class='toc_h6'>" + objLink + " </span>" ;
129
135
else
130
- return indent + " - " + objLink;
136
+ return ' No Result '
131
137
})
132
138
.join (" \n " )
133
139
@@ -186,7 +192,7 @@ Copy the code below and paste it into the new `toc.css` file which should be in
186
192
*/
187
193
188
194
/*
189
- toc > header 2
195
+ header 2
190
196
*/
191
197
192
198
.toc_h2 a
@@ -198,7 +204,7 @@ Copy the code below and paste it into the new `toc.css` file which should be in
198
204
}
199
205
200
206
/*
201
- toc > header 3
207
+ header 3
202
208
*/
203
209
204
210
.toc_h3 a
@@ -210,7 +216,7 @@ Copy the code below and paste it into the new `toc.css` file which should be in
210
216
}
211
217
212
218
/*
213
- toc > header 4, 5, 6
219
+ header 4, 5, 6
214
220
*/
215
221
216
222
.toc_h4 a , .toc_h5 a , .toc_h6 a
@@ -222,7 +228,7 @@ Copy the code below and paste it into the new `toc.css` file which should be in
222
228
}
223
229
224
230
/*
225
- toc > bad links > path
231
+ bad links > path
226
232
*/
227
233
228
234
.toc_badpaths_path , .toc_badpaths_path a
@@ -234,14 +240,24 @@ Copy the code below and paste it into the new `toc.css` file which should be in
234
240
}
235
241
236
242
/*
237
- toc > no results
243
+ no results > total
238
244
*/
239
245
240
246
.toc_results_none
241
247
{
242
248
text-align : center ;
243
249
font-size : 12pt ;
244
250
}
251
+
252
+ /*
253
+ no results > subheader
254
+ */
255
+
256
+ .toc_results_none_subheader
257
+ {
258
+ padding-left : 12px ;
259
+ font-size : 10pt ;
260
+ }
245
261
```
246
262
247
263
<br />
0 commit comments