Allow markdown in post descriptions

This commit is contained in:
Neil Brommer 2023-10-20 09:48:24 -07:00
parent 47184b5939
commit 711dcbab53
2 changed files with 5 additions and 1 deletions

View file

@ -7,6 +7,7 @@ const mdDefList = require("markdown-it-deflist");
const mdToc = require("markdown-it-table-of-contents");
const mdAnchor = require("markdown-it-anchor");
const nunjucksDate = require("nunjucks-date");
const markdownIt = require("markdown-it");
function addEleventyPlugins(eleventyConfig) {
eleventyConfig.addPlugin(eleventyNavigationPlugin);
@ -30,6 +31,9 @@ function configureMarkdown(eleventyConfig) {
}
function addFilters(eleventyConfig) {
let md = new markdownIt();
eleventyConfig.addFilter("renderMarkdown", (mdString) => md.render(mdString));
eleventyConfig.addFilter("log", (value) => console.log(value));
eleventyConfig.addFilter("date", nunjucksDate);
eleventyConfig.addFilter("IsNotPage", (collection, url) =>

View file

@ -29,7 +29,7 @@
{% endfor %}
</div>
</dl>
<p>{{ post.data.description }}</p>
<p>{{ post.data.description | renderMarkdown | safe }}</p>
</section>
{% endfor %}
{% else %}