Skip to content

Commit 6ca72d0

Browse files
committed
docs: update code block features
1 parent a35ac8e commit 6ca72d0

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

docs/notes/theme/guide/code/features.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,23 @@ export default {
218218
}
219219
```
220220

221+
::: tip 在不同的语言代码块中,应该使用该语言的有效的行注释语法
222+
比如在 bash 代码块中,应该使用 `# [!code focus]`
223+
224+
````md
225+
```bash
226+
mkdir hello && cd hello # [\!code focus]
227+
pnpm install
228+
```
229+
````
230+
231+
```bash
232+
mkdir hello && cd hello # [!code focus]
233+
pnpm install
234+
```
235+
236+
:::
237+
221238
## 代码块中的颜色差异
222239

223240
在某一行添加 `// [!code --]``// [!code ++]` 注释将会为该行创建 diff,同时保留代码块的颜色。
@@ -250,6 +267,21 @@ export default {
250267
}
251268
```
252269

270+
::: tip 在不同的语言代码块中,应该使用该语言的有效的行注释语法
271+
比如在 bash 代码块中,应该使用 `# [!code ++]`
272+
273+
````md
274+
```bash
275+
mkdir hello && cd hello # [\!code ++]
276+
```
277+
````
278+
279+
```bash
280+
mkdir hello && cd hello # [!code ++]
281+
```
282+
283+
:::
284+
253285
## 高亮“错误”和“警告”
254286

255287
在某一行添加 `// [!code warning]``// [!code error]` 注释将会为该行相应的着色。
@@ -282,6 +314,21 @@ export default {
282314
}
283315
```
284316

317+
::: tip 在不同的语言代码块中,应该使用该语言的有效的行注释语法
318+
比如在 bash 代码块中,应该使用 `# [!code warning]`
319+
320+
````md
321+
```bash
322+
mkdir hello && cd hello # [\!code warning]
323+
```
324+
````
325+
326+
```bash
327+
mkdir hello && cd hello # [!code warning]
328+
```
329+
330+
:::
331+
285332
## 代码块中 词高亮
286333

287334
**输入:**
@@ -326,6 +373,21 @@ options.foo = 'baz'
326373
console.log(options.foo) // 这个不会被高亮显示
327374
```
328375

376+
:::tip 在不同的语言代码块中,应该使用该语言的有效的行注释语法
377+
比如在 bash 代码块中,应该使用 `# [!code word:hello]`
378+
379+
````md
380+
```bash
381+
mkdir hello && cd hello # [\!code word:hello]
382+
```
383+
````
384+
385+
```bash
386+
mkdir hello && cd hello # [!code word:hello]
387+
```
388+
389+
:::
390+
329391
## 代码块中的 空白符
330392

331393
将空白字符(Tab 和空格)渲染为可见状态。

0 commit comments

Comments
 (0)