feat: add line numbers to prism blocks

This commit is contained in:
Oliver Booth 2023-08-08 02:10:17 +01:00
parent 204269396e
commit 6583a8eba6
Signed by: oliverbooth
GPG Key ID: 725DB725A0D9EE61
1 changed files with 7 additions and 0 deletions

View File

@ -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));