fix: replace eleventy-plugin-footnotes with markdown-it-footnote

Switch from KittyGiraudel's shortcode-based footnotes plugin to
markdown-it-footnote, which handles standard [^1] Markdown syntax
used in Obsidian notes. Remove the {% footnotes %} shortcode from
the post layout as the plugin renders footnotes automatically.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
svemagie
2026-03-23 19:32:40 +01:00
parent fd0d7ae74d
commit 0bc2dc3e88
4 changed files with 11 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
import sitemap from "@quasibit/eleventy-plugin-sitemap";
import markdownIt from "markdown-it";
import markdownItAnchor from "markdown-it-anchor";
import markdownItFootnote from "markdown-it-footnote";
import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
import { minify } from "html-minifier-terser";
import { minify as minifyJS } from "terser";
@@ -20,7 +21,6 @@ import { fileURLToPath } from "url";
const esmRequire = createRequire(import.meta.url);
const postGraph = esmRequire("@rknightuk/eleventy-plugin-post-graph");
const pluginFootnotes = esmRequire("eleventy-plugin-footnotes");
const __dirname = dirname(fileURLToPath(import.meta.url));
const siteUrl = process.env.SITE_URL || "https://example.com";
@@ -99,6 +99,7 @@ export default function (eleventyConfig) {
linkify: true, // Auto-convert URLs to clickable links
typographer: true,
});
md.use(markdownItFootnote);
md.use(markdownItAnchor, {
permalink: markdownItAnchor.permalink.headerLink(),
slugify: (s) => s.toLowerCase().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, ""),
@@ -155,9 +156,7 @@ export default function (eleventyConfig) {
// Mermaid diagram support — renders ```mermaid code blocks as diagrams
eleventyConfig.addPlugin(pluginMermaid);
// Accessible footnotes — {% footnoteref "id" "note text" %}…{% endfootnoteref %}
// Render collected footnotes with {% footnotes %} in the post layout.
eleventyConfig.addPlugin(pluginFootnotes);
// markdown-it-footnote handles standard [^1] Markdown footnote syntax
// Post graph — GitHub-style contribution grid for posting frequency
eleventyConfig.addPlugin(postGraph, {