From 7906c15fa72eade6884b13d4d7649cd82e971682 Mon Sep 17 00:00:00 2001 From: interlope Date: Wed, 3 Jun 2026 13:23:57 +0200 Subject: [PATCH] feat: remove highlight.js line numbers plugin and clean up related code --- css/style.css | 16 --------------- js/blowdit.js | 33 ------------------------------ js/highlightjs-line-numbers.min.js | 1 - metadata.json | 2 +- 4 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 js/highlightjs-line-numbers.min.js diff --git a/css/style.css b/css/style.css index 35ef655..b439c36 100644 --- a/css/style.css +++ b/css/style.css @@ -1867,22 +1867,6 @@ pre code.hljs { background: transparent !important; } -/* Line numbers (highlightjs-line-numbers plugin builds a table inside ) */ -.hljs-ln { border-collapse: collapse; line-height: 1.5; } -.hljs-ln td { padding: 0; border: 0; vertical-align: top; line-height: 1.5; } -.hljs-ln-numbers { - width: 1%; - white-space: nowrap; - text-align: right; - padding-right: 0.9em !important; - color: var(--text-muted); - border-right: 1px solid var(--border-color); - user-select: none; - -webkit-user-select: none; -} -.hljs-ln-code { padding-left: 0.9em !important; } -.hljs-ln-n::before { content: attr(data-line-number); } - /* ======================================== ANCHOR OFFSET — clear the fixed navbar on ToC / hash jumps Without this, jumping to a heading lands it at y=0, hidden behind the diff --git a/js/blowdit.js b/js/blowdit.js index eb6495d..3e2d05d 100644 --- a/js/blowdit.js +++ b/js/blowdit.js @@ -804,39 +804,6 @@ Array.prototype.forEach.call(codes, function (code) { try { window.hljs.highlightElement(code); } catch (e) {} }); - // Line numbers (self-hosted plugin). Skips single-line blocks by default. - var ln = document.createElement('script'); - ln.src = BASE + 'js/highlightjs-line-numbers.min.js'; - ln.onload = function () { - if (!window.hljs || !window.hljs.lineNumbersBlock) return; - Array.prototype.forEach.call(codes, function (code) { - // Drop a trailing newline so the plugin doesn't add a blank last line. - code.innerHTML = code.innerHTML.replace(/\n+$/, ''); - try { window.hljs.lineNumbersBlock(code, { singleLine: false }); } catch (e) {} - }); - // The plugin builds the table on a 0ms timer; clean up afterwards: - // remove any trailing empty row and trailing whitespace nodes that - // would leave a blank "phantom" line at the bottom of the block. - setTimeout(function () { - Array.prototype.forEach.call(codes, function (code) { - var rows = code.querySelectorAll('.hljs-ln tr'); - if (rows.length) { - var last = rows[rows.length - 1]; - var cell = last.querySelector('.hljs-ln-code'); - if (cell && cell.textContent.replace(/\s+/g, '') === '') { - last.parentNode.removeChild(last); - } - } - var n = code.lastChild; - while (n && n.nodeType === 3 && !n.textContent.trim()) { - var prev = n.previousSibling; - code.removeChild(n); - n = prev; - } - }); - }, 60); - }; - document.head.appendChild(ln); }; document.head.appendChild(s); })(); diff --git a/js/highlightjs-line-numbers.min.js b/js/highlightjs-line-numbers.min.js deleted file mode 100644 index a5f9f20..0000000 --- a/js/highlightjs-line-numbers.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(r,o){"use strict";var e,i="hljs-ln",l="hljs-ln-line",h="hljs-ln-code",s="hljs-ln-numbers",c="hljs-ln-n",m="data-line-number",a=/\r\n|\r|\n/g;function u(e){for(var n=e.toString(),t=e.anchorNode;"TD"!==t.nodeName;)t=t.parentNode;for(var r=e.focusNode;"TD"!==r.nodeName;)r=r.parentNode;var o=parseInt(t.dataset.lineNumber),a=parseInt(r.dataset.lineNumber);if(o==a)return n;var i,l=t.textContent,s=r.textContent;for(a
{6}',[l,s,c,m,h,o+n.startFrom,0{1}',[i,r])}return e}(e.innerHTML,o)}function v(e){var n=e.className;if(/hljs-/.test(n)){for(var t=g(e.innerHTML),r=0,o="";r{1}\n',[n,0 [!NOTE]/[!TIP]/[!WARNING]/...), code-block header bar with language label + copy button, visual breadcrumbs, custom 404 page, image figure/figcaption from the markdown title, a mobile table-of-contents drawer, and third-party resource hints. v1.6.0: self-hosted Inter (no Google Fonts), client-side search overlay (\"/\" key + navbar button), keyboard shortcuts (/ , g h, t, Esc), a tabbed-code copy button, series navigation (series-* tag), and content typography (keycaps, task-list checkboxes, , external-link icon, footnote/definition-list styling). Code blocks gained line numbers; the on-page search boxes (hero + sidebar) now open the same instant overlay, and the navbar search icon only appears once they scroll out of view." + "notes": "A Bludit theme inspired by the Blowfish Hugo theme. Five-theme swatch picker (Light/Dark/Nord/Dracula/Catppuccin), sticky ToC sidebar on articles, image lightbox with zoom, image carousel (```carousel fence), tabbed code blocks (```tabs fence), smart sidebar per page type, and clean responsive typography. v1.3.0: SEO (Open Graph, Twitter Card, JSON-LD, theme-color, cover preload), per-theme syntax highlighting (self-hosted highlight.js), copy-to-clipboard on code blocks, numbered pagination, inline-SVG icons (dropped the Bootstrap Icons webfont), removed jQuery/Bootstrap JS, deferred cached JS bundle, reading progress bar, back-to-top, randomised sidebar selection, lazy-loaded images, accessibility (skip link, ARIA, :focus-visible) and a print stylesheet. v1.4.0: canonical URL, WebSite + BreadcrumbList + author sameAs JSON-LD, og:image:alt / twitter:site+creator, cover-image aspect-ratio (CLS), heading anchor links, prev/next article nav, related posts, share buttons (X/LinkedIn/copy-link), mailto social icon, PWA web app manifest, 'updated on' date, and outbound-link hardening (noopener noreferrer). v1.5.0: callout/admonition boxes (> [!NOTE]/[!TIP]/[!WARNING]/...), code-block header bar with language label + copy button, visual breadcrumbs, custom 404 page, image figure/figcaption from the markdown title, a mobile table-of-contents drawer, and third-party resource hints. v1.6.0: self-hosted Inter (no Google Fonts), client-side search overlay (\"/\" key + navbar button), keyboard shortcuts (/ , g h, t, Esc), a tabbed-code copy button, series navigation (series-* tag), and content typography (keycaps, task-list checkboxes, , external-link icon, footnote/definition-list styling). the navbar search icon only appears once the on-page search box scrolls out of view, and code blocks use a header bar (language + copy) with tighter line-height." }