Skip to content

Commit 3691880

Browse files
committed
feat: animations for code highlights
1 parent e277953 commit 3691880

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

guide/syntax.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,34 @@ console.log('HelloWorld')
7272
```
7373
~~~
7474

75+
To highlight specific lines, simply add line numbers within bracket `{}`. Line numbers start count from 1.
76+
77+
~~~md
78+
```ts {2,3}
79+
function add(
80+
a: Ref<number> | number,
81+
b: Ref<number> | number
82+
) {
83+
return computed(() => unref(a) + unref(b))
84+
}
85+
```
86+
~~~
87+
88+
To change the highlight in multiple steps, you can use `|` to separate them. For example
89+
90+
~~~md
91+
```ts {2-3|5|all}
92+
function add(
93+
a: Ref<number> | number,
94+
b: Ref<number> | number
95+
) {
96+
return computed(() => unref(a) + unref(b))
97+
}
98+
```
99+
~~~
100+
101+
This will highlight on `a` and `b` first, then goes to the `computed` line after one click, and then, the whole block. Learn more about the [clicks animations here](/guide/animations).
102+
75103
Whenever you want to do some modification in the presentation, simply add `{monaco}` after the language id, it turns the block into a full-featured Monaco editor!
76104

77105
~~~md

0 commit comments

Comments
 (0)