Add custom admonition for code sandbox (#95)

This commit is contained in:
a.nvlkv
2024-05-11 22:12:35 +03:00
committed by GitHub
parent cde438d67b
commit 40774ab8b5
24 changed files with 303 additions and 27 deletions

13
sandbox.js Normal file
View File

@@ -0,0 +1,13 @@
(() => {
const boxes = document.querySelectorAll("details.admonish-sandbox");
boxes.forEach((box) => {
const once = () => {
const template = box.querySelector("template");
const sandbox = template.content.cloneNode(true);
template.after(sandbox);
box.removeEventListener("toggle", once);
};
box.addEventListener("toggle", once);
});
})();