You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guide/syntax.md
+26-6Lines changed: 26 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,10 +123,10 @@ function add(
123
123
```
124
124
~~~
125
125
126
-
You can enable line number to all slides by setting `lineNumbers: true` on the config or enable each code block individually by setting `lines:true`. You can also set the starting line for each code block and highlight the lines accordingly, defaults to 1:
126
+
You can enable line number to all slides by setting `lineNumbers: true` on the config or enable each code block individually by setting `lines:true`. You can also set the starting line for each code block and highlight the lines accordingly, defaults to 1:
127
127
128
128
~~~md
129
-
```ts {6,7}{lines:true,startLine:5}
129
+
```ts {6,7}{lines:true,startLine:5}
130
130
function add(
131
131
a: Ref<number> | number,
132
132
b: Ref<number> | number
@@ -218,20 +218,40 @@ const count = ref(0)
218
218
219
219
> Available since v0.48
220
220
221
-
Shiki Magic Move enables you to have granular transition between code changes like Keynote's Magic Move. You can check [this demo](https://shiki-magic-move.netlify.app/) to see how it works.
221
+
[Shiki Magic Move](https://github.com/shikijs/shiki-magic-move) enables you to have granular transition between code changes, similar to Keynote's Magic Move. You can check [the playground](https://shiki-magic-move.netlify.app/) to see how it works.
222
222
223
223
In Slidev, we bind it to the [clicks system](/guide/animations#click-animations). The syntax is wrap multiple code blocks representing each steps with <code>````md magic-move</code> (mind it's **4** backticks), this will be transformed into one code block, that morphing to each steps as you click.
224
224
225
225
~~~~md
226
226
````md magic-move
227
-
```ts
227
+
```js
228
228
console.log(`Step ${1}`)
229
229
```
230
-
```ts
230
+
```js
231
231
console.log(`Step ${1 + 1}`)
232
232
```
233
233
```ts
234
-
console.log(`Step ${3}`)
234
+
console.log(`Step ${3}` as string)
235
+
```
236
+
````
237
+
~~~~
238
+
239
+
It's also possible mix Magic Move with [line highlighting](#line-highlighting), for example:
240
+
241
+
~~~~md
242
+
````md magic-move {at:4} // [!code hl]
243
+
```js {*|1|2-5} // [!code hl]
244
+
let count = 1
245
+
function add() {
246
+
count++
247
+
}
248
+
```
249
+
250
+
Non-code blocks in between as ignored, you can put some comments.
0 commit comments