One feature that I frequently use in MediaWiki is inline citation (<ref>...</ref>). Surprisingly, there’s no native support in PmWiki, so I built it myself.In local/config.php, add this.Markup('ref', 'fulltext', '/\\[\\[ref\\]\\](.*?)\\[\\[\\/ref\\]\\]/is', function($m) { static $refcount = 0; $refcount++; //$content = htmlspecialchars($m[1], ENT_QUOTES); $content = $m[1]; return "<sup class=\"pm-ref\" data-ref=\"$content\">[$refcount]</sup>"; } );In pub/custom.js, add this.function sanitize(html) { const temp = document.createElement("div"); temp.innerHTML = html; temp.querySelectorAll("*").forEach(el => { if (!["A","B","I","EM","STRONG","BR"].includes(el.tagName)) { el.replaceWith(...el.childNodes); } if (el.tagName === "A") { el.setAttribute("target", "_blank"); el.setAttribute("rel", "nofollow noopener"); } }); return temp.innerHTML; } document.addEventListener("DOMContentLoaded", function() { let tooltip = null; let pinned = false; let activeRef = null; function…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.