|
|
@ -47,7 +47,7 @@ export async function content() {
|
|
|
|
blocks.push({
|
|
|
|
blocks.push({
|
|
|
|
breadcrumbs: [...breadcrumbs, removeMarkdown(remove_TYPE(metadata.title) ?? '')],
|
|
|
|
breadcrumbs: [...breadcrumbs, removeMarkdown(remove_TYPE(metadata.title) ?? '')],
|
|
|
|
href: get_href([slug]),
|
|
|
|
href: get_href([slug]),
|
|
|
|
content: plaintext(intro),
|
|
|
|
content: await plaintext(intro),
|
|
|
|
rank
|
|
|
|
rank
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -67,7 +67,7 @@ export async function content() {
|
|
|
|
remove_TYPE(removeMarkdown(h2))
|
|
|
|
remove_TYPE(removeMarkdown(h2))
|
|
|
|
],
|
|
|
|
],
|
|
|
|
href: get_href([slug, normalizeSlugify(h2)]),
|
|
|
|
href: get_href([slug, normalizeSlugify(h2)]),
|
|
|
|
content: plaintext(intro),
|
|
|
|
content: await plaintext(intro),
|
|
|
|
rank
|
|
|
|
rank
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -83,7 +83,7 @@ export async function content() {
|
|
|
|
removeMarkdown(remove_TYPE(h3))
|
|
|
|
removeMarkdown(remove_TYPE(h3))
|
|
|
|
],
|
|
|
|
],
|
|
|
|
href: get_href([slug, normalizeSlugify(h2) + '-' + normalizeSlugify(h3)]),
|
|
|
|
href: get_href([slug, normalizeSlugify(h2) + '-' + normalizeSlugify(h3)]),
|
|
|
|
content: plaintext(lines.join('\n').trim()),
|
|
|
|
content: await plaintext(lines.join('\n').trim()),
|
|
|
|
rank
|
|
|
|
rank
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -99,14 +99,15 @@ function remove_TYPE(str) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** @param {string} markdown */
|
|
|
|
/** @param {string} markdown */
|
|
|
|
function plaintext(markdown) {
|
|
|
|
async function plaintext(markdown) {
|
|
|
|
/** @param {unknown} text */
|
|
|
|
/** @param {unknown} text */
|
|
|
|
const block = (text) => `${text}\n`;
|
|
|
|
const block = (text) => `${text}\n`;
|
|
|
|
|
|
|
|
|
|
|
|
/** @param {string} text */
|
|
|
|
/** @param {string} text */
|
|
|
|
const inline = (text) => text;
|
|
|
|
const inline = (text) => text;
|
|
|
|
|
|
|
|
|
|
|
|
return markedTransform(markdown, {
|
|
|
|
return (
|
|
|
|
|
|
|
|
await markedTransform(markdown, {
|
|
|
|
code: (source) => source.split('// ---cut---\n').pop(),
|
|
|
|
code: (source) => source.split('// ---cut---\n').pop(),
|
|
|
|
blockquote: block,
|
|
|
|
blockquote: block,
|
|
|
|
html: () => '\n',
|
|
|
|
html: () => '\n',
|
|
|
@ -130,6 +131,7 @@ function plaintext(markdown) {
|
|
|
|
image: (href, title, text) => text,
|
|
|
|
image: (href, title, text) => text,
|
|
|
|
text: inline
|
|
|
|
text: inline
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
)
|
|
|
|
.replace(/</g, '<')
|
|
|
|
.replace(/</g, '<')
|
|
|
|
.replace(/>/g, '>')
|
|
|
|
.replace(/>/g, '>')
|
|
|
|
.replace(/&#(\d+);/g, (match, code) => {
|
|
|
|
.replace(/&#(\d+);/g, (match, code) => {
|
|
|
|