Add markdown parsing to status entries
This commit is contained in:
@@ -18,6 +18,33 @@ const figoptions = {
|
||||
};
|
||||
|
||||
export default async function (eleventyConfig) {
|
||||
// Customize Markdown library settings:
|
||||
let markdownItOptions = {
|
||||
html: true,
|
||||
typographer: true,
|
||||
};
|
||||
|
||||
let mdLib = markdownIt(markdownItOptions);
|
||||
|
||||
eleventyConfig.amendLibrary("md", (mdLib) => {
|
||||
mdLib
|
||||
.use(markdownItAnchor, {
|
||||
permalink: markdownItAnchor.permalink.ariaHidden({
|
||||
placement: "after",
|
||||
class: "header-anchor",
|
||||
symbol: "#",
|
||||
ariaHidden: false,
|
||||
}),
|
||||
level: [1, 2, 3, 4],
|
||||
slugify: eleventyConfig.getFilter("slugify"),
|
||||
})
|
||||
.use(markdownItFootnote)
|
||||
.use(mdfigcaption, figoptions)
|
||||
.use(markdownItContainer, "info");
|
||||
});
|
||||
|
||||
eleventyConfig.setLibrary("md", mdLib);
|
||||
|
||||
// Collections
|
||||
eleventyConfig.addCollection("galleryImages", (collection) => {
|
||||
const galleries = collection.getAll()[0].data.galleries;
|
||||
@@ -114,6 +141,10 @@ export default async function (eleventyConfig) {
|
||||
return `<abbr title="${def}">${abbr}</abbr>`;
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter("markdownify", (markdownString) => {
|
||||
return mdLib.renderInline(markdownString);
|
||||
});
|
||||
|
||||
// Shortcodes
|
||||
// Audio player
|
||||
eleventyConfig.addShortcode(
|
||||
@@ -181,38 +212,9 @@ export default async function (eleventyConfig) {
|
||||
);
|
||||
});
|
||||
|
||||
// Customize Markdown library settings:
|
||||
let markdownItOptions = {
|
||||
html: true,
|
||||
typographer: true,
|
||||
};
|
||||
|
||||
let mdLib = markdownIt(markdownItOptions);
|
||||
|
||||
eleventyConfig.amendLibrary("md", (mdLib) => {
|
||||
mdLib
|
||||
.use(markdownItAnchor, {
|
||||
permalink: markdownItAnchor.permalink.ariaHidden({
|
||||
placement: "after",
|
||||
class: "header-anchor",
|
||||
symbol: "#",
|
||||
ariaHidden: false,
|
||||
}),
|
||||
level: [1, 2, 3, 4],
|
||||
slugify: eleventyConfig.getFilter("slugify"),
|
||||
})
|
||||
.use(markdownItFootnote)
|
||||
.use(mdfigcaption, figoptions)
|
||||
.use(markdownItContainer, "info");
|
||||
});
|
||||
|
||||
eleventyConfig.setLibrary("md", mdLib);
|
||||
|
||||
return {
|
||||
templateFormats: ["md", "njk", "html", "liquid"],
|
||||
|
||||
markdownTemplateEngine: "njk",
|
||||
|
||||
htmlTemplateEngine: "njk",
|
||||
|
||||
dir: {
|
||||
|
||||
Reference in New Issue
Block a user