From 5b433d653b64022d0bbc7e9a419ae87d90753704 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Tue, 29 Oct 2024 20:09:48 -0700 Subject: [PATCH] fix: support footnotes on dynamic pages --- workers/dynamic-pages/utils/formatters.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/workers/dynamic-pages/utils/formatters.js b/workers/dynamic-pages/utils/formatters.js index 72466a4a..63f540b7 100644 --- a/workers/dynamic-pages/utils/formatters.js +++ b/workers/dynamic-pages/utils/formatters.js @@ -1,4 +1,6 @@ import markdownIt from "markdown-it"; +import markdownItAnchor from "markdown-it-anchor"; +import markdownItFootnote from "markdown-it-footnote"; export const formatDate = (date) => new Date(date).toLocaleDateString("en-US", { @@ -6,4 +8,13 @@ export const formatDate = (date) => month: "long", day: "numeric", }); + export const md = markdownIt({ html: true, linkify: true }); + +md.use(markdownItAnchor, { + level: [1, 2], + permalink: markdownItAnchor.permalink.headerLink({ + safariReaderFix: true, + }), +}); +md.use(markdownItFootnote); \ No newline at end of file