Markdown truncate

Hi,
I have a probleme with my blog :
On main blog page, all articles are diplayed with an image and a truncated text (beacause all article text is too long), but I discover a probleme today : my artucle are written with markdown.
The problem is when text is truncated, it keeps markdown tags, so I can have the first tag ("

for example) but not the last (

) because of the truncate.
That causes HTML issues of tags not correctly closed.

Can we display text without markdown in blog article previews when we truncate ?

Thanks,

Anne

I found this :

instead of writing {{ page.content|truncate(200) }}

we can write :

{% set somehtml = page.content %}
{{ somehtml[:200]|striptags ~ ’ …’ }}

This is working, so I let the post, it can be helpful for someone else :slight_smile:

Also you can use the manual truncate tag to pick a specific point where to truncate the blog for the listing page:

this will be shown in `page.summary()`

===

this will not be shown