Skip to content

Commit 8fc1984

Browse files
committed
feat: allow to set title/level from preparser via frontmatter keys
I went with this solution as it doesn't change the `transformSlide` function signature. Otherwise, the change would either be breaking or we need to add the SlideInfo as redundant function argument (it also contains `content` and `frontmatter`). Having the whole SlideInfo might enable more use cases, but also might have the potential for modifications that shouldn't be done. Closes #2095.
1 parent 9f7e0d0 commit 8fc1984

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/parser/src/core.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ export async function parse(
148148
const newContent = await e.transformSlide(slide.content, slide.frontmatter)
149149
if (newContent !== undefined)
150150
slide.content = newContent
151+
if (typeof slide.frontmatter.title === 'string') {
152+
slide.title = slide.frontmatter.title
153+
}
154+
if (typeof slide.frontmatter.level === 'number') {
155+
slide.level = slide.frontmatter.level
156+
}
151157
}
152158
}
153159
}

0 commit comments

Comments
 (0)