mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 03:11:01 +00:00
Refactor: Remove stale benchmark outputs
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
async function parseMarkdown(md) {
|
||||
const { marked } = await import("https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js");
|
||||
return marked.parse(md);
|
||||
}
|
||||
export default parseMarkdown;
|
||||
// Generation time: 2.382s
|
||||
// Result: PASS
|
||||
@@ -1,7 +0,0 @@
|
||||
async function parseMarkdown(md) {
|
||||
const { marked } = await import("https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js");
|
||||
return marked.parse(md);
|
||||
}
|
||||
export default parseMarkdown;
|
||||
// Generation time: 2.445s
|
||||
// Result: PASS
|
||||
@@ -1,11 +0,0 @@
|
||||
const parseMarkdown = async (md) => {
|
||||
const [{ marked }, { default: sanitize }] = await Promise.all([
|
||||
import('https://esm.sh/marked'),
|
||||
import('https://esm.sh/dompurify')
|
||||
]);
|
||||
|
||||
return sanitize.sanitize(marked.parse(md));
|
||||
};
|
||||
export default parseMarkdown;
|
||||
// Generation time: 7.966s
|
||||
// Result: PASS
|
||||
@@ -1,11 +0,0 @@
|
||||
async function parseMarkdown(markdown) {
|
||||
try {
|
||||
const { marked } = await import('https://cdn.jsdelivr.net/npm/marked@5.1.0/lib/marked.esm.min.js');
|
||||
return marked.parse(markdown);
|
||||
} catch (error) {
|
||||
return `<p>Error parsing markdown: ${error.message}</p>`;
|
||||
}
|
||||
}
|
||||
export default parseMarkdown;
|
||||
// Generation time: 10.685s
|
||||
// Result: PASS
|
||||
@@ -1,4 +0,0 @@
|
||||
const parseMarkdown=async e=>(await import("https://cdn.jsdelivr.net/npm/markdown-it@13.0.2/dist/markdown-it.min.js")).default().render(e)
|
||||
export default parseMarkdown;
|
||||
// Generation time: 9.601s
|
||||
// Result: FAIL
|
||||
@@ -1,13 +0,0 @@
|
||||
let p;
|
||||
|
||||
export const parseMarkdown = async (s) => {
|
||||
p ||= Promise.all([
|
||||
import('https://esm.sh/marked@7.0.4').then(r => r.marked),
|
||||
import('https://esm.sh/dompurify@3.0.5').then(r => r.default)
|
||||
]);
|
||||
const [m, d] = await p;
|
||||
return d.sanitize(m.parse(s));
|
||||
};
|
||||
export default parseMarkdown;
|
||||
// Generation time: 550.549s
|
||||
// Result: PASS
|
||||
@@ -1,8 +0,0 @@
|
||||
let md
|
||||
const parseMarkdown = async s => {
|
||||
md ||= (await import('https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js')).marked
|
||||
return md.parse(s)
|
||||
}
|
||||
export default parseMarkdown;
|
||||
// Generation time: 8.679s
|
||||
// Result: PASS
|
||||
@@ -1,17 +0,0 @@
|
||||
const loadLibs=(()=>{let cache;return async()=>cache||(cache=Promise.all([
|
||||
import('https://cdn.jsdelivr.net/npm/marked@11.1.0/lib/marked.esm.js'),
|
||||
import('https://cdn.jsdelivr.net/npm/dompurify@3.0.6/dist/purify.es.mjs')
|
||||
]).then(([{marked},purifyMod])=>{
|
||||
const purify=(purifyMod.default||purifyMod)(window);
|
||||
marked.setOptions({gfm:true,headerIds:true,mangle:false});
|
||||
return {marked,purify};
|
||||
}));})();
|
||||
|
||||
const parseMarkdown=async input=>{
|
||||
const {marked,purify}=await loadLibs();
|
||||
const html=marked.parse(typeof input==='string'?input:`${input??''}`);
|
||||
return purify.sanitize(html,{USE_PROFILES:{html:true}});
|
||||
};
|
||||
export default parseMarkdown;
|
||||
// Generation time: 15.618s
|
||||
// Result: FAIL
|
||||
@@ -1,21 +0,0 @@
|
||||
let p, md, purify;
|
||||
|
||||
const load = () =>
|
||||
p ??= Promise.all([
|
||||
import("https://cdn.jsdelivr.net/npm/markdown-it@14/dist/markdown-it.esm.js"),
|
||||
import("https://cdn.jsdelivr.net/npm/dompurify@3/dist/purify.es.mjs")
|
||||
]).then(([{ default: MarkdownIt }, { default: DOMPurify }]) => {
|
||||
md ||= new MarkdownIt({ html: true, linkify: true });
|
||||
purify ||= DOMPurify;
|
||||
}).catch(e => {
|
||||
p = 0;
|
||||
throw e;
|
||||
});
|
||||
|
||||
async function parseMarkdown(src) {
|
||||
await load();
|
||||
return purify.sanitize(md.render(`${src ?? ""}`), { USE_PROFILES: { html: true } });
|
||||
}
|
||||
export default parseMarkdown;
|
||||
// Generation time: 136.807s
|
||||
// Result: FAIL
|
||||
Reference in New Issue
Block a user