mirror of
https://github.com/welpo/tabi.git
synced 2025-10-11 07:46:15 +02:00
✨ feat: support Zola's native code block names (#489)
This commit is contained in:
parent
6837f6f4f1
commit
61793b2e56
23 changed files with 228 additions and 195 deletions
1
static/js/codeBlockNameLinks.min.js
vendored
Normal file
1
static/js/codeBlockNameLinks.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll("code[data-name]").forEach(function(e){var t,a=e.getAttribute("data-name");a.startsWith("http")&&((t=document.createElement("a")).href=a,t.className="source-path",t.textContent=a,e.insertBefore(t,e.firstChild),e.removeAttribute("data-name"),e.parentElement?.removeAttribute("data-name"))}),document.querySelectorAll(".code-source").forEach(function(e){var t,a=e.getAttribute("data-source");"PRE"===(e=e.nextElementSibling)?.tagName&&(e=e.querySelector("code"))&&(a.startsWith("http")?((t=document.createElement("a")).href=a,t.className="source-path",t.textContent=a,e.insertBefore(t,e.firstChild)):e.setAttribute("data-name",a))})});
|
Loading…
Add table
Add a link
Reference in a new issue