Skip to content

Commit 55fd7ef

Browse files
committed
docs($markdown): add missing examples for line highlighting (fix vuejs#2473)
Signed-off-by: Diogo Correia <[email protected]>
1 parent d0f2e42 commit 55fd7ef

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

packages/docs/docs/guide/markdown.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,46 @@ export default {
275275
}
276276
```
277277

278+
In addition to a single line, you can also specify multiple lines, line ranges, or both.
279+
280+
- Line ranges: e.g. `{5-8}`, `{3-10}`, `{10-17}`
281+
- Multiple single lines: e.g. `{4,7,9}`
282+
- Line ranges and single lines: e.g. `{4,7-13,16,23-27,40}`
283+
284+
**Input**
285+
286+
````
287+
``` js{1,4,6-7}
288+
export default { // Highlighted
289+
data () {
290+
return {
291+
msg: `Highlighted!
292+
This line isn't highlighted,
293+
but this and the next 2 are.`,
294+
motd: 'VuePress is awesome',
295+
lorem: 'ipsum',
296+
}
297+
}
298+
}
299+
```
300+
````
301+
302+
**Output**
303+
304+
``` js{1,4,6-8}
305+
export default { // Highlighted
306+
data () {
307+
return {
308+
msg: `Highlighted!
309+
This line isn't highlighted,
310+
but this and the next 2 are.`,
311+
motd: 'VuePress is awesome',
312+
lorem: 'ipsum',
313+
}
314+
}
315+
}
316+
```
317+
278318
## Line Numbers
279319

280320
You can enable line numbers for each code blocks via config:

0 commit comments

Comments
 (0)