Your sites Log in Sign up Menu

Parse markdown in metadata teaser?

I've modified the blog template to suit my needs, which includes changes to the entries.html template so that teasers are shown in the "just_titles" branch (should rename it soon, I guess).

Now I've noticed that {{teaser}} is taken from my entry metadata as desired but that markdown formatting in it isn't parsed. Is there a way to achieve that?


2 years ago, 2 replies   Improve this question

(Note: If I don't specifiy the teaser in the metadata, escaped HTML from the entry itself is shown. Would be great if that would not be escaped...)

Answered 2 years ago · Improve this answer

One workaround for your specific case is to define the teaser inside your post content using the {{more}} tag, consider this post for example:

Your *post* here, this part in the teaser, which will be converted from markdown to HTML...

{{more}}

The rest of your post here, also in markdown...

More generally, it's not yet possible to convert custom metadata from Markdown to HTML but I would like to make it so. Perhaps a {{#markdown}}...{{/markdown}} template function could work? Consider the following proposed syntax:

{{#markdown}}
{{{metadata.teaser}}}
{{/markdown}}
Answered 2 years ago · Improve this answer