Skip to content

StripHtml method removes space after elements, resulting in words getting combined #23244

Description

@arknu

Which Umbraco version are you using?

17.5.0

Bug summary

Taking this HTML:

<h1>Test header</h1><p>Some <strong>text</strong> content</p>

and running it through HtmlStringUtilities.StripHtmlTags via the StripHtml extension method on HtmlHelper results in this output

Test headerSome text content

Which is obviously incorrect, as there should be a space between the words. It seems that no space is added after each element that has had its tag stripped. When no space exists between the elements (as between a header and paragraph), no space is is added when stripping.

Specifics

No response

Steps to reproduce

Attempt to strip HTML from normal RTE content, for example to display an excerpt of a larger text.

Expected result / actual result

The first and last words in each paragraph are smushed together, same goes for inline tags like strong.

I would expect there to be proper spacing between the words.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions