slidevjs / slidev

Presentation Slides for Developers
https://sli.dev
MIT License
32.72k stars 1.32k forks source link

`export --format md --output dist/` produces `dist/.md` (and `--output dist/slides.md` fails) #1874

Open vorburger opened 3 hours ago

vorburger commented 3 hours ago

Describe the bug

I would like to Export PNGs and Markdown... primarily so that I can send a PR to https://github.com/slidevjs/docs/blob/main/.vitepress/showcases.ts with a cover: ... 😄

In order for e.g. that Cover PNG to be available, I want it to be in my dist/, along side the HTML app/site, and the PDF which I'm also putting there.

I've tried export --format md --output dist/ - but that produces a dist/.md - note the "empty" filename, which is a bit weird, agreed?

Using export --dark --format md --output dist/slides.md fails, like this:

●■▲ Slidev v0.49.29

theme @slidev/theme-seriph css engine unocss entry /workspaces/LearningMachineLearning/docs/prez/sli.dev/slides.md ▲ rendering...[Error: EISDIR: illegal operation on a directory, open 'dist/slides.md'] { errno: -21, code: 'EISDIR', syscall: 'open', path: 'dist/slides.md' }

Environment

Proposal

Perhaps you would like consider permitting --output dist/slides.md and using that instead of defaulting to dist/.md ?

vorburger commented 3 hours ago

Oh... wait; so: Using export --format md --output dist/png works! (The difference being it not ending in a trailing slash.)

That produces dist/png.md and dist/png/*.png - which makes sense, actually.

Perhaps you would consider handling --output with trailing slash, and automagically chopping it? Just an idea.

Or do you want a PR with an update for a note about this in the doc?

vorburger commented 2 hours ago

Using export --format md --output dist/png works!

Actually, nope, that doesn't really "work" - the links in the MD are broken, they point to ./dist/png/1.png (instead of just png/1.png).

I'm working around this like this.