From 6f5bba5c423dabb2a8410e340ac6a4400ce292d7 Mon Sep 17 00:00:00 2001 From: Mike Kasberg Date: Sat, 28 May 2016 15:38:09 -0600 Subject: [PATCH] Fix Post Preview Strip HTML Bug Fixes #175. If a post was truncated in the middle of an HTML tag, the HTML couldn't be properly stripped and would show up on the page. This commit fixes that. The post preview feature uses 3 filters: markdownify, strip_html, and truncatewords. We need to do truncatewords last so we don't truncate in the middle of a tag. --- .github/CONTRIBUTORS.md | 9 +++++---- _includes/latest-post.html | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/CONTRIBUTORS.md b/.github/CONTRIBUTORS.md index 2fc8ab711..c9facca54 100644 --- a/.github/CONTRIBUTORS.md +++ b/.github/CONTRIBUTORS.md @@ -8,7 +8,8 @@ In alphabetical order: 6. Jørn Ølmheim 7. Kartik Arora 8. Marcus Eisele - 9. Nathan Jaremkio - 10. Panos Sakkos - 11. Prashant Solanki - 12. Sergey Lysenko + 9. Mike Kasberg + 10. Nathan Jaremkio + 11. Panos Sakkos + 12. Prashant Solanki + 13. Sergey Lysenko diff --git a/_includes/latest-post.html b/_includes/latest-post.html index 29b1cfebe..b66a73fb6 100644 --- a/_includes/latest-post.html +++ b/_includes/latest-post.html @@ -18,7 +18,7 @@

{{ post.date | date_to_string }} Comments

- {{ post.content | truncatewords: site.post-preview-words | strip_html | markdownify }} + {{ post.content | strip_html | markdownify | truncatewords: site.post-preview-words }}

View more posts