New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specifing the start line number on code block #2907
Comments
Hello, maybe you try writing it like this in your markdown files:
|
Thank you, it worked as I expectedly!!! |
Sorry, even though I could show specified lines of file, but line number is starting with 1... |
now available in rc.12. refer #2917 for details |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is your feature request related to a problem? Please describe.
I'm writing programming learning text, and I want to specify the start line number on code block to show a part of the whole code.
The below is an example file.
index.js
```
const ddd = 'eee'
function aaa(){
const bbb = 'ccc'
console.log(bbb)
}
```
Then, when I want to show only this
aaa
function, I want to let vitepress show as below(I want to start the line number with 2).2 function aaa(){
3 const bbb = 'ccc'
4 console.log(bbb)
5 }
But with current features of vitepress, we cannot realize it.
Describe the solution you'd like
I suggest below writing rule.
```js @2
function aaa(){
const bbb = 'ccc'
console.log(bbb)
}
```
or
```js:line-numbers @2
function aaa(){
const bbb = 'ccc'
console.log(bbb)
}
```
With
@
, I want to specify the start line number(of course, other than@
is also ok).Describe alternatives you've considered
No response
Additional context
HackMD allows to specify the start line with below way.
https://hackmd.io/features?both#Code-Block
Validations
The text was updated successfully, but these errors were encountered: