fix: fixed footer links

This commit is contained in:
Leyla Becker 2026-02-22 10:47:45 -06:00
parent 748a0b6589
commit a46e05e377
2 changed files with 26 additions and 1 deletions

View file

@ -170,7 +170,7 @@ const sharedPlugins = [
markdownItFootnote,
markdownItHashtag,
markdownItMermaid,
[markdownItTaskLists, { enabled: true, label: true, labelAfter: true }],
[markdownItTaskLists, { enabled: true, label: true, labelAfter: false }],
markdownItDetails,
];
@ -188,6 +188,19 @@ const createMarkdownInstance = (extraPlugins = []) => {
const md = createMarkdownInstance([markdownItStripTrailingHashtags]);
// Customize footnote rendering to remove brackets
md.renderer.rules.footnote_ref = (tokens, idx, options, env, slf) => {
const id = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);
const n = Number(tokens[idx].meta.id + 1).toString();
let refid = id;
if (tokens[idx].meta.subId > 0) {
refid += ':' + tokens[idx].meta.subId;
}
return '<sup class="footnote-ref"><a href="#fn' + id + '" id="fnref' + refid + '">' + n + '</a></sup>';
};
const tagExtractorMd = createMarkdownInstance();
module.exports = (eleventyConfig) => {