Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve vite.config.ts in parent directory #1787

Open
pinage404 opened this issue Jul 27, 2024 · 4 comments
Open

resolve vite.config.ts in parent directory #1787

pinage404 opened this issue Jul 27, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@pinage404
Copy link

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

  1. having the slides.md file in a subfolder

    slidev build ./subfolder/slides.md
  2. with this content in the slides.md

    Normal ^sup^ normal
  3. add markdown-it plugin

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

@KermanX
Copy link
Member

KermanX commented Jul 28, 2024

Sorry, I can't see the content of your vite.config.ts. GitLab says 404 NotFound

@pinage404
Copy link
Author

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)
            },
        },
    },
})

@KermanX
Copy link
Member

KermanX commented Jul 29, 2024

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".

@KermanX KermanX added the enhancement New feature or request label Jul 29, 2024
@KermanX KermanX changed the title Markdown-it plugin bad behavior with subfolder since 0.49.11 resolve vite.config.ts in parent directory Jul 29, 2024
@pinage404
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants