feat: add download .md button to doc viewer
This commit is contained in:
@@ -131,7 +131,8 @@ async function loadDoc(name) {
|
|||||||
if (!resp.ok) throw new Error('HTTP ' + resp.status + ' fetching /doc-wasm/modules/' + name + '.md');
|
if (!resp.ok) throw new Error('HTTP ' + resp.status + ' fetching /doc-wasm/modules/' + name + '.md');
|
||||||
const md = await resp.text();
|
const md = await resp.text();
|
||||||
if (!wasm_exports) throw new Error('WASM not loaded');
|
if (!wasm_exports) throw new Error('WASM not loaded');
|
||||||
el.innerHTML = md2html(md);
|
var dlHtml = '<div style="float:right;margin-bottom:8px"><a href="/doc-wasm/modules/' + name + '.md" download="' + name + '.md" style="text-decoration:none;font-size:13px;color:#0066cc;border:1px solid #0066cc;border-radius:4px;padding:4px 10px">↓ Download .md</a></div>';
|
||||||
|
el.innerHTML = dlHtml + md2html(md);
|
||||||
if (typeof mermaid !== 'undefined') mermaid.run({nodes:[el.querySelector('.mermaid')].filter(Boolean)});
|
if (typeof mermaid !== 'undefined') mermaid.run({nodes:[el.querySelector('.mermaid')].filter(Boolean)});
|
||||||
document.querySelectorAll('.sidebar a.module-link').forEach(function(a) { a.classList.remove('active'); });
|
document.querySelectorAll('.sidebar a.module-link').forEach(function(a) { a.classList.remove('active'); });
|
||||||
var link = document.querySelector('.sidebar a[data-module="' + name + '"]');
|
var link = document.querySelector('.sidebar a[data-module="' + name + '"]');
|
||||||
|
|||||||
Reference in New Issue
Block a user