diff --git a/eleventy.config.js b/eleventy.config.js index 5c4d741..76e3cdf 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,5 +1,6 @@ const { DateTime } = require("luxon"); const markdownItAnchor = require("markdown-it-anchor"); +const pluginTOC = require('eleventy-plugin-toc') const pluginRss = require("@11ty/eleventy-plugin-rss"); const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); const pluginNavigation = require("@11ty/eleventy-navigation"); @@ -9,6 +10,7 @@ const htmlmin = require('html-minifier'); let options = { // whatever options you have set for the library here + html: true, typographer: true, quotes: ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'], }; @@ -41,6 +43,11 @@ module.exports = function(eleventyConfig) { eleventyConfig.addPlugin(pluginSyntaxHighlight); eleventyConfig.addPlugin(pluginNavigation); eleventyConfig.addPlugin(EleventyHtmlBasePlugin); + eleventyConfig.addPlugin(pluginTOC, { + tags: ['h2', 'h3'], + wrapperClass: 'table-of-contents', + ul: true, + }); eleventyConfig.addFilter("env", (key, def="NOT DEFINED") => process.env[key] || def); @@ -109,11 +116,6 @@ module.exports = function(eleventyConfig) { // Customize Markdown library and settings: eleventyConfig.amendLibrary("md", mdLib => { mdLib.use(markdownItAnchor, { - permalink: markdownItAnchor.permalink.ariaHidden({ - placement: "after", - class: "direct-link", - symbol: "#", - }), level: [1,2,3,4], slugify: eleventyConfig.getFilter("slug") }); diff --git a/package.json b/package.json index 15f8291..ac11db0 100644 --- a/package.json +++ b/package.json @@ -22,24 +22,24 @@ "@11ty/eleventy-navigation": "^0.3.5", "@11ty/eleventy-plugin-rss": "^1.2.0", "@11ty/eleventy-plugin-syntaxhighlight": "^4.1.0", - "markdown-it-anchor": "^8.6.4", - "markdown-it-image-figures": "^2.1.0", - "luxon": "^3.0.4", - "@babel/core": "^7.18.2", "@babel/preset-env": "^7.18.2", "autoprefixer": "^10.4.7", "babel-loader": "^8.2.5", "core-js": "^3.22.8", "css-loader": "^6.7.1", + "css-minimizer-webpack-plugin": "^4.0.0", + "eleventy-plugin-toc": "^1.1.5", "eslint": "^8.17.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-plugin-import": "^2.26.0", "html-minifier": "^4.0.0", + "luxon": "^3.0.4", + "markdown-it-anchor": "^8.6.4", + "markdown-it-image-figures": "^2.1.0", "md5-file": "^5.0.0", "mini-css-extract-plugin": "^2.6.0", "npm-run-all": "^4.1.5", - "css-minimizer-webpack-plugin": "^4.0.0", "postcss-loader": "^7.0.0", "rimraf": "^3.0.2", "sass": "^1.52.2", diff --git a/src/_layouts/article.njk b/src/_layouts/article.njk index 9264527..0262d97 100644 --- a/src/_layouts/article.njk +++ b/src/_layouts/article.njk @@ -2,6 +2,11 @@ layout: blog.njk templateClass: tmpl-post --- +{%- if toc %} + +{%- endif %}