Move code block for custom container shortcode

This commit is contained in:
Helen Chong 2024-05-07 10:26:21 +08:00
parent d059c8ff30
commit a12bd804a8
1 changed files with 7 additions and 7 deletions

View File

@ -63,13 +63,6 @@ module.exports = function (eleventyConfig) {
},
};
// 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}>`;
});
/* Markdown Overrides */
let markdownLibrary = markdownIt({
html: true,
@ -79,6 +72,13 @@ module.exports = function (eleventyConfig) {
.use(require("markdown-it-bracketed-spans"))
.use(require("markdown-it-deflist"));
// 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}>`;
});
// Paired shorcode: Spoiler accordion
eleventyConfig.addPairedShortcode('spoiler', (content, hint) => {
const hintMarkup = markdownLibrary.renderInline(hint);