Install markdown-it-attrs and markdown-it-bracketed-spans plugins

This commit is contained in:
Helen Chong
2024-05-07 13:45:47 +08:00
parent 94e3185e64
commit 2f2311422f
3 changed files with 21 additions and 1 deletions

BIN
bun.lockb

Binary file not shown.

View File

@@ -9,4 +9,22 @@ const markdownIt = require("markdown-it");
module.exports = function (eleventyConfig) {
// Installed plugins
eleventyConfig.addPlugin(embedEverything, { add: ['soundcloud'] });
/* Markdown Overrides */
let markdownLibrary = markdownIt({
html: true,
})
.use(require("markdown-it-attrs"))
.use(require("markdown-it-bracketed-spans"))
// Paired shortcode: custom container
eleventyConfig.addPairedShortcode('container', (children, el, className) => {
const classMarkup = className ? ` class="${className}"` : "";
const content = markdownLibrary.render(children);
return `<${el}${classMarkup}>${content}</${el}>`;
});
/* This is the part that tells 11ty to swap to our custom config */
eleventyConfig.setLibrary("md", markdownLibrary);
}

View File

@@ -19,6 +19,8 @@
"@11ty/eleventy-plugin-rss": "^1.2.0",
"@11tyrocks/eleventy-plugin-emoji-readtime": "^1.0.1",
"eleventy-plugin-embed-everything": "^1.18.2",
"eleventy-plugin-metagen": "^1.8.3"
"eleventy-plugin-metagen": "^1.8.3",
"markdown-it-attrs": "^4.1.6",
"markdown-it-bracketed-spans": "^1.0.1"
}
}