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 @@
|
||||
const parseMarkdown = async (md) => {
|
||||
const { marked } = await import('https://cdn.jsdelivr.net/npm/marked@11.1.1/+esm');
|
||||
const { marked } = await import('https://cdn.jsdelivr.net/npm/marked@11/+esm');
|
||||
return marked.parse(md);
|
||||
};
|
||||
export default parseMarkdown;
|
||||
@@ -1,6 +1,12 @@
|
||||
const parseMarkdown = async (markdown) => {
|
||||
const cdnUrl = 'https://cdn.jsdelivr.net/npm/marked@13.0.0/lib/marked.esm.js';
|
||||
const { marked } = await import(cdnUrl);
|
||||
return marked.parse(markdown ?? '');
|
||||
const parseMarkdown = async (markdownText) => {
|
||||
const cdnUrl = 'https://cdn.jsdelivr.net/npm/marked@13.0.2/lib/marked.esm.js';
|
||||
|
||||
try {
|
||||
const { marked } = await import(cdnUrl);
|
||||
return marked.parse(markdownText || '');
|
||||
} catch (err) {
|
||||
console.error(`Failed to parse markdown: ${err}`);
|
||||
return markdownText || '';
|
||||
}
|
||||
};
|
||||
export default parseMarkdown;
|
||||
@@ -0,0 +1,5 @@
|
||||
const parseMarkdown = async md => {
|
||||
const { parse } = await import('https://cdn.jsdelivr.net/npm/marked@12.0.1/lib/marked.esm.js')
|
||||
return parse(md)
|
||||
}
|
||||
export default parseMarkdown;
|
||||
@@ -1,9 +1,13 @@
|
||||
const parseMarkdown = async m => {
|
||||
async function parseMarkdown(md) {
|
||||
const u = 'https://cdn.jsdelivr.net/npm/marked@9/lib/marked.esm.js';
|
||||
const o = {gfm:true,breaks:true,headerIds:false,mangle:false};
|
||||
|
||||
try {
|
||||
const {marked} = await import('https://esm.sh/marked');
|
||||
return marked.parse(m);
|
||||
} catch (e) {
|
||||
return `<pre>${e.message}</pre>`;
|
||||
const {marked} = await import(u);
|
||||
marked.setOptions(o);
|
||||
return marked.parse(md);
|
||||
} catch(e) {
|
||||
return `<p>${e.message}</p>`;
|
||||
}
|
||||
};
|
||||
}
|
||||
export default parseMarkdown;
|
||||
@@ -1,5 +0,0 @@
|
||||
export async function parseMarkdown(m){
|
||||
const {marked}=await import('https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js')
|
||||
return marked.parse(m)
|
||||
}
|
||||
export default parseMarkdown;
|
||||
@@ -1,5 +1,5 @@
|
||||
const parseMarkdown=async(md='')=>{
|
||||
const{marked}=await import('https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js');
|
||||
return marked.parse(md);
|
||||
};
|
||||
const parseMarkdown=async m=>{
|
||||
const {marked}=await import('https://cdn.jsdelivr.net/npm/marked@11.1.0/lib/marked.esm.js')
|
||||
return marked.parse(m)
|
||||
}
|
||||
export default parseMarkdown;
|
||||
@@ -1,35 +0,0 @@
|
||||
async function parseMarkdown(md) {
|
||||
const { default: marked } = await import('https://cdn.skypack.dev/marked@14.1.2');
|
||||
marked.use({
|
||||
breaks: true,
|
||||
gfm: true,
|
||||
async tokenize(src) {
|
||||
const tokens = marked.lexer(src);
|
||||
for (const token of tokens) {
|
||||
if (token.type === 'list') {
|
||||
token.ordered = token.ordered || false;
|
||||
token.loose = !!token.items.find(item => item.text.includes('\n'));
|
||||
}
|
||||
}
|
||||
return tokens;
|
||||
},
|
||||
renderer: {
|
||||
heading(text, level) { return `<h${level}>${text}</h${level}>`; },
|
||||
strong(text) { return `<strong>${text}</strong>`; },
|
||||
em(text) { return `<em>${text}</em>`; },
|
||||
codespan(text) { return `<code>${text}</code>`; },
|
||||
link(href, title, text) { return `<a href="${href}"${title ? ` title="${title}"` : ''}>${text}</a>`; },
|
||||
code(code, infostring) {
|
||||
const lang = (infostring || '').match(/^([a-z0-9]+)/i);
|
||||
return `<pre><code class="${lang ? `language-${lang[1]}` : ''}">${code}</code></pre>`;
|
||||
},
|
||||
list(body, ordered) {
|
||||
const type = ordered ? 'ol' : 'ul';
|
||||
return `<${type}>${body}</${type}>`;
|
||||
},
|
||||
blockquote(quote) { return `<blockquote>${quote}</blockquote>`; }
|
||||
}
|
||||
});
|
||||
return marked.parse(md);
|
||||
}
|
||||
export default parseMarkdown;
|
||||
@@ -1,5 +1,5 @@
|
||||
async function parseMarkdown(text) {
|
||||
const {marked} = await import('https://unpkg.com/marked@14.1.2?module');
|
||||
return marked(text);
|
||||
async function parseMarkdown(md){
|
||||
const{marked}=await import('https://esm.sh/marked');
|
||||
return marked.parse(md);
|
||||
}
|
||||
export default parseMarkdown;
|
||||
Reference in New Issue
Block a user