slidevjs / slidev

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

Shiki Magic Move ignores transformers from ./setup/shiki.ts #1462

Open Sdju opened 5 months ago

Sdju commented 5 months ago
  1. create setup/shiki.ts
  2. add some transformers eg
    
    /* ./setup/shiki.ts */
    import { defineShikiSetup } from '@slidev/types'
    import { transformerNotationDiff, transformerNotationWordHighlight } from '@shikijs/transformers'

export default defineShikiSetup(() => { return { themes: { 'dark': 'min-light', 'light': 'min-light', }, transformers: [ transformerNotationWordHighlight(), ] } })

2.1 add some basic styles for class `highlighted-word`
3. add new slide with some content with shiki magic move and some content without it
`````md
```html
// [!code word:article]
<article>
  <h1>
    Hello
  </h1>
</article>
```html
// [!code word:article]
<article>
  <h1>
    Hello
  </h1>
</article>
  1. check the result image

As i can see there is difference betwheen the magic move version and the version without it. In the documentation no clues about that. In the shiki config gide too.

I really want to use word highlighting + magic move. If it is not possible then the documentation should warn about it.

Thank You!

antfu commented 5 months ago

Unfortunately, Magic Move does not support transformers at this moment

Sdju commented 5 months ago

Thank You for answering!

It's OK. Then, i think. the documentation should contain this information

Something like this: #1464