slidev
slidev copied to clipboard
resolve `vite.config.ts` in parent directory
Hi,
Describe the bug
Markdown-it plugin seems to not work when the slides.md file is in a subfolder
Minimal reproduction
Steps to reproduce the behavior:
I did a minimal reproductible test repository https://gitlab.com/pinage404/slidev_bad_subfolder_behavior/-/commits/main/?ref_type=HEADS
-
having the
slides.mdfile in a subfolderslidev build ./subfolder/slides.md -
with this content in the
slides.mdNormal ^sup^ normal
With [email protected], plugin works With [email protected], the build works but the plugin seems ignored With [email protected] (current latest), same behavior as 0.49.11
Alternative solution
Moving the slides.md in the root folder fix it
Additional context
I noticed the backward incompatibility on this slide (the corresponding code)
Environment
- Slidev version: 0.49.11 and newer
- Browser: not relevant, it fails event when building Firefox 128.0.2 (64-bit)
- OS: NixOS 24.05.20240725.a1cc729 (Uakari) x86_64
~~If you are using Slidev globally (i.e. npx slidev or npm i -g slidev), please try to reproduce the issue in a local project (i.e. npm create slidev@latest).~~
It was really long and hard to isolate the problem, good luck with this one
Sorry, I can't see the content of your vite.config.ts. GitLab says 404 NotFound
Weird, it works for me
Here is the content
import MarkdownItSup from 'markdown-it-sup'
import { defineConfig } from 'vite'
export default defineConfig({
slidev: {
markdown: {
markdownItSetup(md) {
md.use(MarkdownItSup)
},
},
},
})
It seems that the vite.config.ts hasn't been run. Move the vite.config.ts to the subfolder (next to slides.md) can fix this. Let's keep this issue open so that we can improve the behavior of the detection of "user root".
It used to work in 0.49.10 and below
I imagine that 0.49.11 introduces a behavior change
Thanks, i did a symlink in the subfolders this fix the issue
Hey folks, what's the current status of moving slides to a nested folders? I run a single slidev setup with multiple slides and noticed this issue. Layouts are not found too, so I moved back to leaving slides in the root folder, which I guess is not so bad, but I am wondering what's the expected behaviour.
There are two not bad workaround:
- Extract shared
vite.config.tsandsetups/*to a new directory, and use the directory as an addon. - Add
../as an addon