feat: add hack to remove line numbers in codeblocks

This commit is contained in:
Oliver Booth 2024-04-26 17:22:35 +01:00
parent 817019ad16
commit 238f519e0c
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5

View File

@ -136,6 +136,11 @@ class UI {
public static addLineNumbers(element?: Element) {
element = element || document.body;
element.querySelectorAll("pre code").forEach((block) => {
if (block.className.indexOf("|nolinenumbers") > 0) {
block.className = block.className.replaceAll("|nolinenumbers", "");
return;
}
let content = block.textContent;
if (content.trim().split("\n").length > 1) {
block.parentElement.classList.add("line-numbers");