2022-08-11 12:38:08 +00:00
|
|
|
//@ts-check
|
|
|
|
|
|
|
|
import { fetchText } from "./fetchText.mjs";
|
|
|
|
import { waitIfLocalHost } from "./waitIfLocalHost.mjs";
|
2023-05-18 21:33:33 +00:00
|
|
|
import { markupToDom } from "./markupToDom.mjs"
|
2022-08-11 12:38:08 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-09 02:00:53 +00:00
|
|
|
* Loads and parses a markdown document. Makes use of micromark.
|
2022-08-11 12:38:08 +00:00
|
|
|
* @param {string} path the path to load
|
|
|
|
*/
|
|
|
|
export const fetchMarkdown = (path) =>
|
|
|
|
fetchText(path)
|
|
|
|
.then(waitIfLocalHost())
|
2023-05-18 21:33:33 +00:00
|
|
|
.then(raw => markupToDom(raw, path));
|
2022-08-11 20:29:46 +00:00
|
|
|
|
|
|
|
export default fetchMarkdown;
|