mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 00:27:55 +00:00
Docs: Update benchmark results
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
async function parseMarkdown(md) {
|
||||
const parseMarkdown = async (md) => {
|
||||
const { marked } = await import('https://cdn.jsdelivr.net/npm/marked@11.1.1/+esm');
|
||||
return marked.parse(md);
|
||||
}
|
||||
};
|
||||
export default parseMarkdown;
|
||||
@@ -1,5 +1,6 @@
|
||||
const parseMarkdown = async (md) => {
|
||||
const { marked } = await import('https://cdn.jsdelivr.net/npm/marked@5/+esm');
|
||||
return marked.parse(md);
|
||||
};
|
||||
async function parseMarkdown(markdown) {
|
||||
const cdn = 'https://cdn.jsdelivr.net/npm/marked@12/lib/marked.esm.js';
|
||||
const { marked } = await import(cdn);
|
||||
return marked.parse(markdown);
|
||||
}
|
||||
export default parseMarkdown;
|
||||
@@ -1,15 +1,6 @@
|
||||
let md,pd
|
||||
const getMd=()=>md||(md=import('https://cdn.jsdelivr.net/npm/marked@12.0.2/+esm').then(x=>{
|
||||
let m=x.marked||x.default
|
||||
m.setOptions?.({gfm:true,breaks:true,smartypants:true})
|
||||
return s=>m.parse?m.parse(s):m(s)
|
||||
}))
|
||||
const getPurify=()=>pd||(pd=import('https://esm.sh/dompurify@3?target=es2020').then(x=>{
|
||||
let d=x.default||x.DOMPurify||x
|
||||
return typeof d.sanitize=='function'?d:d(window)
|
||||
}))
|
||||
async function parseMarkdown(s){
|
||||
let [render,pur]=await Promise.all([getMd(),getPurify()])
|
||||
return pur.sanitize(render(s))
|
||||
}
|
||||
const parseMarkdown=async t=>{
|
||||
parseMarkdown.l??=import('https://cdn.jsdelivr.net/npm/marked@12.0.2/lib/marked.esm.js');
|
||||
const{marked}=await parseMarkdown.l;
|
||||
return marked.parse(t||'');
|
||||
};
|
||||
export default parseMarkdown;
|
||||
@@ -1,11 +1,14 @@
|
||||
async function parseMarkdown(markdown) {
|
||||
const {marked} = await import('https://cdn.jsdelivr.net/npm/marked@12.0.2/lib/marked.esm.js')
|
||||
async function parseMarkdown(md) {
|
||||
if (typeof md !== "string") md = String(md ?? "");
|
||||
const [{ default: marked }] = await Promise.all([
|
||||
import("https://cdn.jsdelivr.net/npm/marked@12.0.2/lib/marked.esm.js")
|
||||
]);
|
||||
marked.setOptions({
|
||||
gfm:true,
|
||||
breaks:false,
|
||||
headerIds:true,
|
||||
mangle:false
|
||||
})
|
||||
return marked.parse(String(markdown ?? ''))
|
||||
gfm: true,
|
||||
breaks: false,
|
||||
headerIds: true,
|
||||
mangle: false
|
||||
});
|
||||
return marked.parse(md);
|
||||
}
|
||||
export default parseMarkdown;
|
||||
Reference in New Issue
Block a user