nimib
nimib copied to clipboard
Add: function to add line numbers to block
This PR is not finished yet. Attempt to fix #101. to do:
- [x] addLineNumbersToHighlightedCode has to be called
- [ ] move tests to the correct files
- [ ] Separate numbers from code in the generated HTML so that code can be copy-pasted without the numbers.
I am not satisfied with this generated HTML but at least it renders the numbers correctly.
Why not use something like https://github.com/wcoder/highlightjs-line-numbers.js? Though I'm not sure about the impact on nimitheme...
Using it with this stylesheet works for me:
td.hljs-ln-numbers {
text-align: center;
color: #ccc;
vertical-align: top;
padding-right: 5px;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
td.hljs-ln-code {
padding-left: 1em;
}
/* Fix for water.css*/
table.hljs-ln {
width: initial;
margin-bottom: 0;
}
table.hljs-ln tbody tr:nth-child(2n) {
background-color: unset;
}