Redesign site and streamline playground
This commit is contained in:
@@ -94,6 +94,17 @@ export function allDocSlugs() {
|
||||
return Object.keys(docs).filter((slug) => slug !== 'index');
|
||||
}
|
||||
|
||||
export function docTitle(slug, items = nav) {
|
||||
for (const item of items) {
|
||||
if (item.slug === slug) return item.title;
|
||||
if (item.children) {
|
||||
const childTitle = docTitle(slug, item.children);
|
||||
if (childTitle) return childTitle;
|
||||
}
|
||||
}
|
||||
return slug;
|
||||
}
|
||||
|
||||
export function renderMarkdown(slug) {
|
||||
const source = docs[slug] ?? docs.index;
|
||||
const html = marked.parse(source ?? '# Not found\n');
|
||||
|
||||
Reference in New Issue
Block a user