feat: add hack to remove line numbers in codeblocks
This commit is contained in:
parent
817019ad16
commit
238f519e0c
@ -136,6 +136,11 @@ class UI {
|
|||||||
public static addLineNumbers(element?: Element) {
|
public static addLineNumbers(element?: Element) {
|
||||||
element = element || document.body;
|
element = element || document.body;
|
||||||
element.querySelectorAll("pre code").forEach((block) => {
|
element.querySelectorAll("pre code").forEach((block) => {
|
||||||
|
if (block.className.indexOf("|nolinenumbers") > 0) {
|
||||||
|
block.className = block.className.replaceAll("|nolinenumbers", "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let content = block.textContent;
|
let content = block.textContent;
|
||||||
if (content.trim().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
Block a user