From 18b4be3d438a91f1a5d0bae0427d98639ea1a7a0 Mon Sep 17 00:00:00 2001 From: Utsob Roy Date: Thu, 23 Feb 2023 15:40:38 +0600 Subject: [PATCH] fix: Footnote in heading (#89) --- .eleventy.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.eleventy.js b/.eleventy.js index 43a41fd83..78a23b722 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -140,6 +140,22 @@ module.exports = function (eleventyConfig) { return defaultLinkRule(tokens, idx, options, env, self); }; + // Footnote heading fix (till the upstream releases the fix) + md.renderer.rules.render_footnote_anchor_name = ( + tokens, + idx, + options, + env + ) => { + var n = Number(tokens[idx].meta.id + 1).toString(); + var prefix = ""; + + if (env && typeof env.docId === "string") { + prefix = "-" + env.docId + "-"; + } + + return prefix + n; + }; }); eleventyConfig.setLibrary("md", markdownLib);