Skip to content

Commit 58eb57e

Browse files
committed
docs: Update docs for "line numbers"
1 parent 87b1233 commit 58eb57e

File tree

7 files changed

+97
-1
lines changed

7 files changed

+97
-1
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ https://vuepress.vuejs.org/
2323
* [Table of Contents](https://vuepress.vuejs.org/guide/markdown.html#table-of-contents)
2424
* [Custom Containers](https://vuepress.vuejs.org/guide/markdown.html#custom-containers)
2525
* [Line Highlighting](https://vuepress.vuejs.org/guide/markdown.html#line-highlighting-in-code-blocks)
26-
* [line Numbers](https://vuepress.vuejs.org/config/#markdown-linenumbers)
26+
* [Line Numbers](https://vuepress.vuejs.org/guide/markdown.html#line-numbers)
2727
* [Import Code Snippets](https://vuepress.vuejs.org/guide/markdown.html#import-code-snippets)
2828

2929
**Using Vue in Markdown**

Diff for: docs/.vuepress/public/line-numbers-desktop.png

139 KB
Loading

Diff for: docs/.vuepress/public/line-numbers-mobile.gif

223 KB
Loading

Diff for: docs/config/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ Provide config options to the used theme. The options will vary depending on the
145145

146146
Whether to show line numbers to the left of each code blocks.
147147

148+
**Also see:**
149+
150+
- [Line Numbers](../guide/markdown.md#line-numbers)
151+
148152
### markdown.slugify
149153

150154
- Type: `Function`

Diff for: docs/guide/markdown.md

+44
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,50 @@ export default {
224224
}
225225
```
226226

227+
## Line Numbers
228+
229+
You can enable line numbers for each code blocks via config:
230+
231+
``` js
232+
module.exports = {
233+
markdown: {
234+
lineNumbers: true
235+
}
236+
}
237+
```
238+
239+
<!-- TODO Support line numbers for specific fence block -->
240+
241+
- Demo:
242+
243+
<picture>
244+
<source srcset="/line-numbers-desktop.png" media="(min-width: 719px)">
245+
<img class="line-numbers-desktop-snap" alt="Image">
246+
</picture>
247+
248+
<picture>
249+
<source srcset="/line-numbers-mobile.gif" media="(max-width: 719px)">
250+
<img class="line-numbers-mobile-snap" alt="Image">
251+
</picture>
252+
253+
<style>
254+
@media screen and (min-width: 719px) {
255+
.line-numbers-mobile-snap {
256+
display: none;
257+
}
258+
}
259+
@media screen and (max-width: 719px) {
260+
.line-numbers-desktop-snap {
261+
display: none;
262+
}
263+
.line-numbers-mobile-snap {
264+
max-width: none!important;
265+
margin: 0 -1.5rem;
266+
width: 100vw;
267+
}
268+
}
269+
</style>
270+
227271
## Import Code Snippets <Badge text="Experimental" type="warn"/> <Badge text="0.10.1+" type="tip"/>
228272

229273
You can import code snippets from existing files via following syntax:

Diff for: docs/zh/config/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ module.exports = {
144144

145145
是否在每个代码块的左侧显示行号。
146146

147+
**Also see:**
148+
149+
- [行号](../guide/markdown.md#行号)
150+
147151
### markdown.anchor
148152

149153
- 类型: `Object`

Diff for: docs/zh/guide/markdown.md

+44
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,50 @@ export default {
222222
}
223223
```
224224

225+
## 行号
226+
227+
你可以通过配置来为每个代码块显示行号:
228+
229+
``` js
230+
module.exports = {
231+
markdown: {
232+
lineNumbers: true
233+
}
234+
}
235+
```
236+
237+
<!-- TODO Support line numbers for specific fence block -->
238+
239+
- 示例:
240+
241+
<picture>
242+
<source srcset="/line-numbers-desktop.png" media="(min-width: 719px)">
243+
<img class="line-numbers-desktop-snap" alt="Image">
244+
</picture>
245+
246+
<picture>
247+
<source srcset="/line-numbers-mobile.gif" media="(max-width: 719px)">
248+
<img class="line-numbers-mobile-snap" alt="Image">
249+
</picture>
250+
251+
<style>
252+
@media screen and (min-width: 719px) {
253+
.line-numbers-mobile-snap {
254+
display: none;
255+
}
256+
}
257+
@media screen and (max-width: 719px) {
258+
.line-numbers-desktop-snap {
259+
display: none;
260+
}
261+
.line-numbers-mobile-snap {
262+
max-width: none!important;
263+
margin: 0 -1.5rem;
264+
width: 100vw;
265+
}
266+
}
267+
</style>
268+
225269
## 导入代码段 <Badge text="Experimental" type="warn"/> <Badge text="0.10.1+" type="tip"/>
226270

227271
你可以通过下述的语法导入已经存在的文件中的代码段:

0 commit comments

Comments
 (0)