fix: strip HTML tags from derived excerpt

gsub(/<[^>]+>/, '') before stripping markdown markup, so auto-generated
excerpts don't leak raw HTML from post bodies.
This commit is contained in:
2026-06-25 22:06:49 +02:00
parent 4597c685da
commit d26d3b5a5b
3 changed files with 11 additions and 1 deletions
+6
View File
@@ -30,6 +30,12 @@ class PostTest < Minitest::Test
assert_equal "The body paragraph.", post.excerpt
end
def test_derived_excerpt_strips_html_tags
body = "<strong>Bold</strong> and <em>italic</em>."
post = Volumen::Post.new(metadata: { "slug" => "x" }, body: body)
assert_equal "Bold and italic.", post.excerpt
end
def test_summary_shape
post = Volumen::Post.new(metadata: { "slug" => "x", "title" => "X" }, body: "Body")
summary = post.summary