From 6583a8eba6cfe8f172a8de2f1757673c4b6f0878 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Tue, 8 Aug 2023 02:10:17 +0100 Subject: [PATCH] feat: add line numbers to prism blocks --- src/ts/app.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ts/app.ts b/src/ts/app.ts index 5c6c116..74ca90e 100644 --- a/src/ts/app.ts +++ b/src/ts/app.ts @@ -2,6 +2,13 @@ declare const bootstrap: any; declare const katex: any; (() => { + document.querySelectorAll("pre code").forEach((block) => { + const content = block.textContent; + if (content.split("\n").length > 1) { + block.parentElement.classList.add("line-numbers"); + } + }); + const list = document.querySelectorAll('[data-bs-toggle="tooltip"]'); list.forEach((el: Element) => new bootstrap.Tooltip(el));