Migrate documentation site to Astro
This commit is contained in:
@@ -79,18 +79,18 @@ export const nav = [
|
||||
{ title: 'Open Issues', slug: 'open-issues' },
|
||||
];
|
||||
|
||||
marked.setOptions({
|
||||
gfm: true,
|
||||
mangle: false,
|
||||
headerIds: true,
|
||||
});
|
||||
marked.setOptions({ gfm: true });
|
||||
|
||||
export function allDocSlugs() {
|
||||
return Object.keys(docs).filter((slug) => slug !== 'index');
|
||||
}
|
||||
|
||||
export function renderMarkdown(slug) {
|
||||
const source = docs[slug] ?? docs.index;
|
||||
const html = marked.parse(source ?? '# Not found\n');
|
||||
return html.replace(/href="([^"#][^"]*)\.md(#[^"]*)?"/g, (_all, href, hash = '') => {
|
||||
const target = normalizeDocLink(slug, href);
|
||||
return `href="#/docs/${target}${hash}"`;
|
||||
return `href="/docs/${target}/${hash}"`;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user