diff --git a/pipeline.go b/pipeline.go index 3159b4f..e8c52ce 100644 --- a/pipeline.go +++ b/pipeline.go @@ -3,6 +3,7 @@ package html import ( + htmlstd "html" "strings" "unicode" @@ -48,7 +49,7 @@ func StripTags(html string) string { b.WriteRune(r) seenText = true } - return b.String() + return htmlstd.UnescapeString(b.String()) } // pipeline.go: Imprint renders a node tree to HTML, strips tags, tokenises the text, diff --git a/pipeline_test.go b/pipeline_test.go index 265b0e3..c8f0bec 100644 --- a/pipeline_test.go +++ b/pipeline_test.go @@ -55,10 +55,10 @@ func TestStripTags_NoTags(t *testing.T) { } func TestStripTags_Entities(t *testing.T) { - got := StripTags(`<script>`) - want := "<script>" + got := StripTags(`

& <script>

`) + want := "&