Skip to content

determine the name of the .md file used to generate the slides inside the deck #1577

Closed Answered by gureckis
gureckis asked this question in Q&A
Discussion options

You must be logged in to vote

Here is an updated solution. The above works but when you open the slide editor in the browser and edit something it writes the entire content of the transformed lines back out to the file. The previous code was re-inserting the file name multiple times so instead this checks if the filename property exists first before adding it, or otherwise updates it.

The net effect is you could define filename: yourself in the front matter but it will be overwritten at launch time with the path to the file

import { definePreparserSetup } from '@slidev/types'

export default definePreparserSetup(({ filepath, headmatter, mode }) => {
  return [
    {
      transformRawLines(lines) {
        // if front…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@gureckis
Comment options

Answer selected by gureckis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants