feat: enable adding URL/path to code blocks (#307)

This commit is contained in:
welpo
2024-05-03 17:37:40 +02:00
parent 0cbd727f25
commit b70efd1642
17 changed files with 175 additions and 10 deletions

1
static/js/addSrcToCodeBlock.min.js vendored Normal file
View File

@@ -0,0 +1 @@
document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".code-source").forEach(function(t){var e,n=t.getAttribute("data-source"),t=t.nextElementSibling;t&&"PRE"===t.tagName&&(t=t.querySelector("code"))&&((e=document.createElement(n.startsWith("http")?"a":"span")).textContent=n,e.className="source-path",n.startsWith("http")&&(e.href=n),t.prepend(e))})});