Skip to content

Commit

Permalink
Merged footnote fix into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole Eskild Steensen committed Mar 6, 2023
2 parents 8026d6f + 2adca7b commit 9343b19
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 16 deletions.
19 changes: 3 additions & 16 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ module.exports = function (eleventyConfig) {
breaks: true,
html: true,
})
.use(require("markdown-it-anchor"), {
slugify: headerToId,
})
.use(require("markdown-it-mark"))
.use(require("markdown-it-footnote"))
.use(function (md) {
Expand Down Expand Up @@ -145,22 +148,6 @@ 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;
};
})
.use(userMarkdownSetup);

Expand Down
60 changes: 60 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"gray-matter": "^4.0.3",
"lunr": "^2.3.9",
"markdown-it": "^13.0.1",
"markdown-it-anchor": "^8.6.7",
"markdown-it-attrs": "^4.1.6",
"markdown-it-footnote": "^3.0.3",
"markdown-it-mark": "^3.0.1",
Expand Down

0 comments on commit 9343b19

Please sign in to comment.