fix: don't display line numbers for one-line blocks
This commit is contained in:
parent
fa51e0a189
commit
7279c448da
|
@ -1,10 +1,10 @@
|
||||||
declare const bootstrap: any;
|
declare const bootstrap: any;
|
||||||
declare const katex: any;
|
declare const katex: any;
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
document.querySelectorAll("pre code").forEach((block) => {
|
document.querySelectorAll("pre code").forEach((block) => {
|
||||||
let content = block.textContent;
|
let content = block.textContent;
|
||||||
if (content.split("\n").length > 1) {
|
if (content.trim().split("\n").length > 1) {
|
||||||
block.parentElement.classList.add("line-numbers");
|
block.parentElement.classList.add("line-numbers");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue