-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
code-group plugin #1865
Comments
Sorry, Slidev doesn't support code-group out of the box. You can install a corresponding MarkdownIt plugin manually (https://sli.dev/custom/config-vite) |
Ok. Could you please mention that point on the feature description? It will be very helpfull |
By the way, are there others |
Sorry, I didn't explain very clearly. All features described in https://sli.dev/features/ works out of the box unless the doc says some options should be set. |
Sorry to bother you but I cannot figure how vite.config.ts should be like to get |
Use https://github.com/hunghg255/markdown-it-code-group: vite.config.ts: import { defineConfig } from 'vite'
import CodeGroup from 'markdown-it-code-group'
export default defineConfig({
slidev: {
markdown: {
/* markdown-it options */
markdownItSetup(md) {
/* custom markdown-it plugins */
md.use(CodeGroup)
},
},
/* options for other plugins */
},
}) styles/index.ts: import 'markdown-it-code-group/styles/code-group-colors-light.css'
import 'markdown-it-code-group/styles/code-group-colors-dark-media.css'
import 'markdown-it-code-group/styles/code-group-base.css' |
Just followed your suggestion: |
This problem is kind of tricky😥 |
Ok but how do you get this working in the slidev website? |
The website is built with VitePress, where this feature can be used directly. Slidev does some transformations to the Markdown before passing it to MarkdownIt, and that's why |
I'm quite confused.
|
VitePress and Slidev are diffrent softwares. Installing VitePress as a dependency doesn't affect how Slidev runs. Code group is a built-in feature in VitePress, but this feature is currently incompatible with Slidev. |
Sorry to be "rude" but then why is "code-group" feature in the doc? |
The "code-group" feature is in the doc because it visually looks better than just putting two code blocks in a column 😇. Other project's docs like Vue also uses this VitePress's feature: https://vuejs.org/guide/quick-start.html#creating-a-vue-application.
Yes. By the way, I personally don't think it is a good idea to put code groups into slides 😇. |
I wonder if it could work using:
with a syntax like: https://github.com/nuxt/content/blob/b429b1810ba90dad557aa6392c18c0c9b2cc51a3/docs/content/2.usage/2.markdown.md?plain=1#L127C1-L149C3 |
I think the “code-group” is awesome feature compared to PPT. Hope it can be Integrated into slidev. |
Describe the bug
I would like to use code-group feature on debian Bookworm with node v18.19.0.
Minimal reproduction
Steps to reproduce the behavior:
git clone slidev
virtualenv env
source env/bin/activate
npm install -g @slidev/cli
cd docs/features/
npm exec slidev --- --port 5050 "frontmatter-merging.md"
It fails with:
Environment
The text was updated successfully, but these errors were encountered: