Back to packages list

Vals using remark-html

Description from the NPM package:
remark plugin to compile Markdown to HTML
1
2
3
4
5
6
7
8
9
10
export const markdownToHtml = async (md: string) => {
const remarkHtml = (await import("npm:remark-html")).default;
const { unified } = await import("https://esm.sh/unified@10?bundle");
const markdown = (await import("npm:remark-parse")).default;
const file = await unified()
.use(markdown)
.use(remarkHtml)
.process(md);
return String(file);
};
1
2
3
4
5
6
7
8
9
10
export const markdownToHtml = async (md: string) => {
const remarkHtml = (await import("npm:remark-html")).default;
const { unified } = await import("https://esm.sh/unified@10?bundle");
const markdown = (await import("npm:remark-parse")).default;
const file = await unified()
.use(markdown)
.use(remarkHtml)
.process(md);
return String(file);
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { fetch } from "https://esm.town/v/std/fetch";
export const markdownToHtml = async (res, req) => {
const remarkHtml = (await import("npm:remark-html")).default;
const unified = (await import("npm:unified")).unified;
const markdown = (await import("npm:remark-parse")).default;
const markdownToConvert = fetch(
"https://jessmartin-todoMarkdown.express.val.run",
);
unified()
.use(markdown)
.use(remarkHtml)
.process(markdownToConvert, function (err, file) {
if (err)
throw err;
res.send("test");
});
};
1
Next