Allow markdown in post descriptions
This commit is contained in:
parent
47184b5939
commit
711dcbab53
|
@ -7,6 +7,7 @@ const mdDefList = require("markdown-it-deflist");
|
||||||
const mdToc = require("markdown-it-table-of-contents");
|
const mdToc = require("markdown-it-table-of-contents");
|
||||||
const mdAnchor = require("markdown-it-anchor");
|
const mdAnchor = require("markdown-it-anchor");
|
||||||
const nunjucksDate = require("nunjucks-date");
|
const nunjucksDate = require("nunjucks-date");
|
||||||
|
const markdownIt = require("markdown-it");
|
||||||
|
|
||||||
function addEleventyPlugins(eleventyConfig) {
|
function addEleventyPlugins(eleventyConfig) {
|
||||||
eleventyConfig.addPlugin(eleventyNavigationPlugin);
|
eleventyConfig.addPlugin(eleventyNavigationPlugin);
|
||||||
|
@ -30,6 +31,9 @@ function configureMarkdown(eleventyConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addFilters(eleventyConfig) {
|
function addFilters(eleventyConfig) {
|
||||||
|
let md = new markdownIt();
|
||||||
|
|
||||||
|
eleventyConfig.addFilter("renderMarkdown", (mdString) => md.render(mdString));
|
||||||
eleventyConfig.addFilter("log", (value) => console.log(value));
|
eleventyConfig.addFilter("log", (value) => console.log(value));
|
||||||
eleventyConfig.addFilter("date", nunjucksDate);
|
eleventyConfig.addFilter("date", nunjucksDate);
|
||||||
eleventyConfig.addFilter("IsNotPage", (collection, url) =>
|
eleventyConfig.addFilter("IsNotPage", (collection, url) =>
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
<p>{{ post.data.description }}</p>
|
<p>{{ post.data.description | renderMarkdown | safe }}</p>
|
||||||
</section>
|
</section>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
Loading…
Reference in a new issue