refactor: convert markdown parsing to IIFE and preserve indentation

This commit is contained in:
tekh 2025-11-18 11:34:37 +01:00
parent bc732d311c
commit e66c46767e
2 changed files with 6 additions and 6 deletions

View File

@ -4,8 +4,8 @@ marked.use({
gfm: true, gfm: true,
}); });
( (async () => {
document.querySelectorAll('.markdown').forEach(async el => { for (const el of document.querySelectorAll('.markdown')) {
el.innerHTML = await marked.parse(el.textContent); el.innerHTML = await marked.parse(el.textContent.replace(/(\t| )/g, " "));
}) }
)() })();

View File

@ -1 +1 @@
marked.use({"async":!0,breaks:!0,gfm:!0});document.querySelectorAll(".markdown").forEach(async n=>{n.innerHTML=await marked.parse(n.textContent)})(); marked.use({"async":!0,breaks:!0,gfm:!0});(async()=>{for(const n of document.querySelectorAll(".markdown"))n.innerHTML=await marked.parse(n.textContent.replace(/(\t| )/g," "))})();