-
Notifications
You must be signed in to change notification settings - Fork 0
/
docsify-quizdown.min.js
1 lines (1 loc) · 1 KB
/
docsify-quizdown.min.js
1
(function(){var myPlugin=function(hook,vm){const config=window.$docsify.quizdown;var regex={quizWrapperStart:/[\r\n]\s*<!-+\s+quizdown:\s*?start\s+-+>/g,quizWrapperEnd:/[\r\n]\s*<!-+\s+quizdown:\s*?end\s+-+>/g};hook.beforeEach((function(e){return e=(e=e.replaceAll(regex.quizWrapperStart,"\n````quizdown")).replaceAll(regex.quizWrapperEnd,"\n````")})),hook.doneEach((function(){const codeBlocks=document.querySelectorAll("pre[data-lang='quizdown']");codeBlocks.forEach((codeBlock=>{const code=codeBlock.textContent.trim(),container=document.createElement("div");with(container.className="quizdown",codeBlock.parentNode.replaceChild(container,codeBlock),window.quizdown.createApp(code,container,config),container.shadowRoot.querySelector(".quizdown-content").style)maxWidth="none",padding="0",margin="2em 0";const style=document.createElement("style");style.innerHTML="pre > code { display: block; }",container.shadowRoot.appendChild(style)}))}))};$docsify=$docsify||{},$docsify.plugins=[].concat(myPlugin,$docsify.plugins)})();