Description
Is your feature request related to a problem? Please describe.
In a scenario of a multi user slides each user should be able to add custom slide notes and override the existing one.
Describe the solution you'd like
Add in the slidev/packages/types/src/types.ts
file after line 124
a new function to the SlidevPreparserExtension
type:
transformNote?: (note: string, frontmatter: any) => Promise<string | undefined>
slidev/packages/types/src/types.ts
Lines 121 to 125 in da595c1
Add in the slidev/packages/parser/src/core.ts
file after line 158
a new call of the transformNote
function:
if (e.transformNote) {
const newNote = await e.transformNote(slide.note, slide.frontmatter)
if (newNote !== undefined)
slide.note = newNote
}
slidev/packages/parser/src/core.ts
Lines 145 to 158 in da595c1
Describe alternatives you've considered
I tried to solve it using the transformRawLines(lines)
function, but it would require some custom logic, which would break the structure of the slides.md
.
Example
A example could look like this:
---
layout: custom
_note: notes/note_1.md
---
Content
<!--
Default notes
-->
Using the transformNote
function the notes could be replaced if the frontmatter contains the _notes
property.