@@ -88,14 +88,20 @@ let p = dv.pages(filter_page)
8888 {
8989 const headings = cache.headings; // get headings from cache
9090
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+
9197 if (headings)
9298 {
9399 const houtput = headings.slice(0) // exclude the first heading
94100 .filter(h => h.level <= 6)
95101 .map(h =>
96102 {
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();
99105 if (header_skip === "table_of_contents" || header_skip === "toc")
100106 {
101107 return ""
@@ -104,13 +110,13 @@ let p = dv.pages(filter_page)
104110 count++;
105111
106112 // 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;
109115
110116 // 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 ];
114120
115121 let objLink = " [[" + file_name + " #" + file_head + " |" + file_title + " ]]" ;
116122
@@ -127,7 +133,7 @@ let p = dv.pages(filter_page)
127133 else if ( h .level == 6 )
128134 return indent + " - <span class='toc_h6'>" + objLink + " </span>" ;
129135 else
130- return indent + " - " + objLink;
136+ return ' No Result '
131137 })
132138 .join (" \n " )
133139
@@ -186,7 +192,7 @@ Copy the code below and paste it into the new `toc.css` file which should be in
186192*/
187193
188194 /*
189- toc > header 2
195+ header 2
190196 */
191197
192198 .toc_h2 a
@@ -198,7 +204,7 @@ Copy the code below and paste it into the new `toc.css` file which should be in
198204 }
199205
200206 /*
201- toc > header 3
207+ header 3
202208 */
203209
204210 .toc_h3 a
@@ -210,7 +216,7 @@ Copy the code below and paste it into the new `toc.css` file which should be in
210216 }
211217
212218 /*
213- toc > header 4, 5, 6
219+ header 4, 5, 6
214220 */
215221
216222 .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
222228 }
223229
224230 /*
225- toc > bad links > path
231+ bad links > path
226232 */
227233
228234 .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
234240 }
235241
236242 /*
237- toc > no results
243+ no results > total
238244 */
239245
240246 .toc_results_none
241247 {
242248 text-align : center ;
243249 font-size : 12pt ;
244250 }
251+
252+ /*
253+ no results > subheader
254+ */
255+
256+ .toc_results_none_subheader
257+ {
258+ padding-left : 12px ;
259+ font-size : 10pt ;
260+ }
245261```
246262
247263<br />
0 commit comments