fix: Footnote in heading (#89)

This commit is contained in:
Utsob Roy 2023-02-23 15:40:38 +06:00 committed by GitHub
parent 717492ba19
commit 18b4be3d43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);