diff --git a/.eleventy.js b/.eleventy.js index 5d785fb..33fc13d 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,21 +1,35 @@ const { EleventyHtmlBasePlugin } = require("@11ty/eleventy"); +const markdownIt = require("markdown-it"); +const markdownItAnchor = require("markdown-it-anchor"); module.exports = function (eleventyConfig) { + let markdownItOptions = { + html: true, // you can include HTML tags + }; + + let markdownItAnchorOptions = { + level: 2, // minimum level header -- anchors will only be applied to h2 level headers and below but not h1 + permalink: true, + }; // Copy static assets to output - eleventyConfig.setTemplateFormats([ "html", "liquid", "njk", "md" ]); + eleventyConfig.setTemplateFormats(["html", "liquid", "njk", "md"]); eleventyConfig.addPassthroughCopy("src/css"); eleventyConfig.addPassthroughCopy("src/js"); eleventyConfig.addPassthroughCopy("src/image"); eleventyConfig.addPassthroughCopy("*.pdf"); - eleventyConfig.addPlugin(EleventyHtmlBasePlugin); + eleventyConfig.setLibrary( + "md", + markdownIt(markdownItOptions).use(markdownItAnchor, markdownItAnchorOptions) + ); + eleventyConfig.addPlugin(EleventyHtmlBasePlugin); return { dir: { input: "src", output: "dist", includes: "_includes", - layouts: "_layouts", + layouts: "_layouts", }, pathPrefix: "/2024/", }; diff --git a/package.json b/package.json index 2c43890..a03afc9 100644 --- a/package.json +++ b/package.json @@ -12,5 +12,9 @@ "license": "ISC", "devDependencies": { "@11ty/eleventy": "^2.0.1" + }, + "dependencies": { + "markdown-it": "^14.1.0", + "markdown-it-anchor": "^9.2.0" } } diff --git a/src/_pages-content/faq.md b/src/_pages-content/faq.md index 54f82e3..555126d 100644 --- a/src/_pages-content/faq.md +++ b/src/_pages-content/faq.md @@ -22,7 +22,8 @@ Workshops will be 3-hour-long interactive sessions where attendees can learn by #### September 23, 2024: Devsprints During the Devsprints, people contribute to open-source projects, guided by mentors. This is a nice way to get started with contributing to Python and other open-source projects. -