Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kermanx
Copy link
Member

@kermanx kermanx commented Jul 9, 2024

This PR is based on #1708. It will be much smaller after merging that one.

Previously, it wasn't possible to import assets via relative paths. For example, ![](./assets/a.png). This was because the slides contents were loaded as /@slidev/slide/1.md.

This PR loads the slides in path/to/slides.md as path/to/slides.md__slidev_x.md, where x is the slide no in the presentation, instead of the slide no in that Markdown file. And /@slidev/slide/x.md works as a facade which re-exports path/to/slides.md__slidev_x.md. The same for frontmatter.

The reason why not use urls like path/to/slides.md?slidev=x.md is that this will conflict with Vue's logic. The Vue plugin doesn't preserve the query of the URL. Also, Vue plugin's include option only matches the path part without query string.

This PR also splits vite/loaders.ts into multiple files - each Vite plugin has its own file. And removed most of the usages of enforce/order.

@netlify
Copy link

netlify bot commented Jul 9, 2024

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit 0eb66ce
🔍 Latest deploy log https://app.netlify.com/sites/slidev/deploys/6698722558519d00084acdec
😎 Deploy Preview https://deploy-preview-1744--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kermanx kermanx marked this pull request as ready for review July 17, 2024 14:16
@antfu
Copy link
Member

antfu commented Jul 17, 2024

Thanks for working on it! You are amazing!

Copy link
Member

@antfu antfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with the direction, I'll let you handle the merge and release

@kermanx kermanx merged commit 42d563c into slidevjs:main Jul 18, 2024
@kermanx kermanx changed the title fix: should support relative import inside slides feat: support relative import inside slides Jul 18, 2024
@kermanx kermanx deleted the fix/allow-relative-path branch July 18, 2024 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants