Skip to content

Commit 89edde8

Browse files
committed
Quartz sync: Jun 10, 2025, 6:31 PM
1 parent 0031f5a commit 89edde8

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

quartz/components/scripts/slide.inline.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,13 @@ function handleFootnote(data: string, separator: string) {
181181
}
182182
)
183183

184-
return slides.join(separator)
184+
return slides.join("\n---\n")
185185
}
186186

187187
function handleIndex(data: string, separator: string, option: SlideOptions, index: string) {
188188
const slides = data.split(separator)
189189

190-
if (!option.index) return slides.join("\n---\n");
190+
if (!option.index || !index) return slides.join(separator);
191191
slides.splice(1, 0, index)
192192

193193
const indexMap = new Map<string, number>()
@@ -223,14 +223,16 @@ function handleIndex(data: string, separator: string, option: SlideOptions, inde
223223
)
224224
}
225225

226-
return slides.join("\n---\n")
226+
return slides.join(separator)
227227
}
228228

229229
function makeIndex() {
230230

231231
const headers = document.querySelectorAll('article.popover-hint h1[id]');
232232
const index = Array.from(headers).map(head => `<li><a data-href="${head.textContent}" class="">${head.textContent}</a></li>`).join('')
233233

234+
if (!index) return ""
235+
234236
return `
235237
<h1 class="slide-index-title">Index</h1>
236238
<ul class="slide-index-list" >
@@ -257,13 +259,15 @@ function appendRemark(option: SlideOptions) {
257259
anchorBlank(
258260
unwrapSlideNote(
259261
unwrapFootnotesSection(
260-
handleIndex(
261-
handleFootnote(
262+
handleFootnote(
263+
handleIndex(
262264
injectSeparators(header + (option.tags ? tags : "") + body, separator),
263-
separator
265+
separator,
266+
option,
267+
makeIndex()
264268
),
265-
separator, option, makeIndex()
266-
)
269+
separator
270+
),
267271
)
268272
)
269273
)

0 commit comments

Comments
 (0)