Skip to content

feat: enhance code block & code group #2174

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

Merged
merged 5 commits into from
May 18, 2025
Merged

Conversation

yuyinws
Copy link
Contributor

@yuyinws yuyinws commented May 16, 2025

This PR add vitepress-plugin-group-icons to enhance the document's readability. And add title bar for lot of code blocks.

Screenshot

image image

Copy link

netlify bot commented May 16, 2025

Deploy Preview for slidev failed.

Name Link
🔨 Latest commit 22759a4
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/682993d23efecc0008667c8b

@yuyinws yuyinws marked this pull request as ready for review May 16, 2025 08:39
@antfu
Copy link
Member

antfu commented May 18, 2025

Thank you! Btw, are you interested in implementing the codeblock and codegroup features in Slidev's slide rendering as well? That would be a great addition!

Copy link

pkg-pr-new bot commented May 18, 2025

Open in StackBlitz

@slidev/client

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/client@2174

create-slidev

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev@2174

create-slidev-theme

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev-theme@2174

@slidev/parser

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/parser@2174

@slidev/cli

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/cli@2174

@slidev/types

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/types@2174

commit: 22759a4

@yuyinws
Copy link
Contributor Author

yuyinws commented May 18, 2025

Sure, I am happy to try it! And I will open another PR for it.

@antfu antfu merged commit 80c8d42 into slidevjs:main May 18, 2025
16 of 20 checks passed
@himito
Copy link

himito commented May 18, 2025

Hi,

I would like to use it in my slides, so installed vitepress-plugin-group-icons. However, I have not been able to make it work :(

What I have done so far is:

  • I modified vite.config.ts
import { defineConfig } from 'vite'
import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons'

export default defineConfig({
  slidev: {
    markdown: {
      markdownItSetup(md) {
        md.use(groupIconMdPlugin)
      }
    }
  },
  plugins: [
    groupIconVitePlugin()
  ],
})
  • and, then I modified ./styles/index.ts with
import 'virtual:group-icons.css'
  • and finally I added to slides.md

::: code-group

import User from './User.vue'
createApp(App).use(router).mount('#app')

:::

Do you know what I would be missing? Maybe it's not the good way to use vue plugins :/

Thank you in advance,
Jaime

@yuyinws
Copy link
Contributor Author

yuyinws commented May 18, 2025

Hi Jaime,

This PR only add the plugin to slidev's docs.

And it can't been used to slidev's slide directly for now.

I will implementing it on Slidev's slide rendering soon.

@himito
Copy link

himito commented May 19, 2025

thank you @yuyinws

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.

3 participants