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:
@@ -100,9 +100,6 @@ withBlogSidebar: true
|
|||||||
{# Rich reply context with h-cite microformat #}
|
{# Rich reply context with h-cite microformat #}
|
||||||
{% include "components/reply-context.njk" %}
|
{% include "components/reply-context.njk" %}
|
||||||
|
|
||||||
{# Footnotes collected from {% footnoteref %} shortcodes in the content #}
|
|
||||||
{% footnotes %}
|
|
||||||
|
|
||||||
{# AI usage disclosure — articles and notes only #}
|
{# AI usage disclosure — articles and notes only #}
|
||||||
{% if '/articles/' in page.url or '/notes/' in page.url %}
|
{% if '/articles/' in page.url or '/notes/' in page.url %}
|
||||||
<details class="mt-4 text-xs text-surface-700 dark:text-surface-300">
|
<details class="mt-4 text-xs text-surface-700 dark:text-surface-300">
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
|
|||||||
import sitemap from "@quasibit/eleventy-plugin-sitemap";
|
import sitemap from "@quasibit/eleventy-plugin-sitemap";
|
||||||
import markdownIt from "markdown-it";
|
import markdownIt from "markdown-it";
|
||||||
import markdownItAnchor from "markdown-it-anchor";
|
import markdownItAnchor from "markdown-it-anchor";
|
||||||
|
import markdownItFootnote from "markdown-it-footnote";
|
||||||
import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
|
import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
|
||||||
import { minify } from "html-minifier-terser";
|
import { minify } from "html-minifier-terser";
|
||||||
import { minify as minifyJS } from "terser";
|
import { minify as minifyJS } from "terser";
|
||||||
@@ -20,7 +21,6 @@ import { fileURLToPath } from "url";
|
|||||||
|
|
||||||
const esmRequire = createRequire(import.meta.url);
|
const esmRequire = createRequire(import.meta.url);
|
||||||
const postGraph = esmRequire("@rknightuk/eleventy-plugin-post-graph");
|
const postGraph = esmRequire("@rknightuk/eleventy-plugin-post-graph");
|
||||||
const pluginFootnotes = esmRequire("eleventy-plugin-footnotes");
|
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
const siteUrl = process.env.SITE_URL || "https://example.com";
|
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
|
linkify: true, // Auto-convert URLs to clickable links
|
||||||
typographer: true,
|
typographer: true,
|
||||||
});
|
});
|
||||||
|
md.use(markdownItFootnote);
|
||||||
md.use(markdownItAnchor, {
|
md.use(markdownItAnchor, {
|
||||||
permalink: markdownItAnchor.permalink.headerLink(),
|
permalink: markdownItAnchor.permalink.headerLink(),
|
||||||
slugify: (s) => s.toLowerCase().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, ""),
|
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
|
// Mermaid diagram support — renders ```mermaid code blocks as diagrams
|
||||||
eleventyConfig.addPlugin(pluginMermaid);
|
eleventyConfig.addPlugin(pluginMermaid);
|
||||||
|
|
||||||
// Accessible footnotes — {% footnoteref "id" "note text" %}…{% endfootnoteref %}
|
// markdown-it-footnote handles standard [^1] Markdown footnote syntax
|
||||||
// Render collected footnotes with {% footnotes %} in the post layout.
|
|
||||||
eleventyConfig.addPlugin(pluginFootnotes);
|
|
||||||
|
|
||||||
// Post graph — GitHub-style contribution grid for posting frequency
|
// Post graph — GitHub-style contribution grid for posting frequency
|
||||||
eleventyConfig.addPlugin(postGraph, {
|
eleventyConfig.addPlugin(postGraph, {
|
||||||
|
|||||||
7
package-lock.json
generated
7
package-lock.json
generated
@@ -33,6 +33,7 @@
|
|||||||
"lite-youtube-embed": "^0.3.2",
|
"lite-youtube-embed": "^0.3.2",
|
||||||
"markdown-it": "^14.1.1",
|
"markdown-it": "^14.1.1",
|
||||||
"markdown-it-anchor": "^9.2.0",
|
"markdown-it-anchor": "^9.2.0",
|
||||||
|
"markdown-it-footnote": "^4.0.0",
|
||||||
"pagefind": "^1.3.0",
|
"pagefind": "^1.3.0",
|
||||||
"rss-parser": "^3.13.0",
|
"rss-parser": "^3.13.0",
|
||||||
"satori": "^0.19.2",
|
"satori": "^0.19.2",
|
||||||
@@ -4082,6 +4083,12 @@
|
|||||||
"markdown-it": "*"
|
"markdown-it": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/markdown-it-footnote": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/markdown-it-footnote/-/markdown-it-footnote-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-WYJ7urf+khJYl3DqofQpYfEYkZKbmXmwxQV8c8mO/hGIhgZ1wOe7R4HLFNwqx7TjILbnC98fuyeSsin19JdFcQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/markdown-it/node_modules/entities": {
|
"node_modules/markdown-it/node_modules/entities": {
|
||||||
"version": "4.5.0",
|
"version": "4.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
"lite-youtube-embed": "^0.3.2",
|
"lite-youtube-embed": "^0.3.2",
|
||||||
"markdown-it": "^14.1.1",
|
"markdown-it": "^14.1.1",
|
||||||
"markdown-it-anchor": "^9.2.0",
|
"markdown-it-anchor": "^9.2.0",
|
||||||
|
"markdown-it-footnote": "^4.0.0",
|
||||||
"pagefind": "^1.3.0",
|
"pagefind": "^1.3.0",
|
||||||
"rss-parser": "^3.13.0",
|
"rss-parser": "^3.13.0",
|
||||||
"satori": "^0.19.2",
|
"satori": "^0.19.2",
|
||||||
|
|||||||
Reference in New Issue
Block a user