Hi, i have been trying to display the line numbers on the left side in Rust code blocks in mdbook, i want to display the line numbers without making the code block editable. Any ideas on how to do that ?
fn main() {
println!("Hello, world!");
}
Hi, i have been trying to display the line numbers on the left side in Rust code blocks in mdbook, i want to display the line numbers without making the code block editable. Any ideas on how to do that ?
fn main() {
println!("Hello, world!");
}
mdBook only supports line numbers on editable code blocks. According to the mdBook documentation:
- line-numbers Display line numbers on editable sections of code. Requires both
editableandcopy-jsto betrue. Defaults tofalse.
If you need line numbers on non-editable code blocks, you will need to fork the mdBook code and make the changes yourself.
alternatively, inject custom js code using the additional-js config option:
for instance, the first result googling "highlightjs line number plugin" is:
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.