minor refactoring
This commit is contained in:
@ -19,7 +19,7 @@ export const bootstrap = async () => {
|
||||
Burger.addEventListener("click", mode.menuOpen.toggle);
|
||||
|
||||
mode.loading.on();
|
||||
const lines = await fetchText("../files.txt");
|
||||
const lines = await fetchText("files.txt");
|
||||
const links = parseFileList(lines);
|
||||
const firstHref = links[0].href;
|
||||
sortFileListLines(links);
|
||||
|
@ -6,6 +6,8 @@ import { generateDomFromString } from "./generateDomFromString.mjs";
|
||||
import {getFirstTitleContent} from "./getFirstTitleContent.mjs";
|
||||
// @ts-ignore
|
||||
import { micromark } from "https://esm.sh/micromark@3?bundle";
|
||||
// @ts-ignore
|
||||
import {frontmatter, frontmatterHtml} from 'https://esm.sh/micromark-extension-frontmatter@1?bundle'
|
||||
|
||||
/**
|
||||
* Loads and parses a markdown document. Makes use of micromark.
|
||||
@ -15,7 +17,11 @@ export const fetchMarkdown = (path) =>
|
||||
fetchText(path)
|
||||
.then(waitIfLocalHost())
|
||||
.then((raw) => {
|
||||
const content = generateDomFromString(micromark(raw));
|
||||
const output = micromark(raw, {
|
||||
extensions: [frontmatter()],
|
||||
htmlExtensions: [frontmatterHtml()]
|
||||
})
|
||||
const content = generateDomFromString(output);
|
||||
const title = getFirstTitleContent(content) || path.replace(/\.\w{2, 4}$/, "");
|
||||
return { title, raw, content };
|
||||
});
|
||||
|
Reference in New Issue
Block a user