Skip to content

HTML highlighter should escape its input #1464

Closed
@tuomassalo

Description

Hi!

I'm trying out HTML highlighter. I believe the highlighter takes plain text as input and outputs HTML text. Thus, it should treat its input as plain text and properly escape it when adding <mark> tags.

Let's say I have three documents:

id: "doc1", text: "Lorem ipsum dolor sit amet"
id: "doc2", text: "Thelma & Louise"
id: "doc3", text: "I <3 Blancmange"
id: "doc4", text: "The <script> tag is potentially dangerous"

If I search for Lorem, I get a nice HTML fragment <mark>Lorem</mark> ipsum dolor sit amet.

However, if I search for Thelma, I get <mark>Thelma & Louise</mark>. I would expect to get <mark>Thelma &amp; Louise</mark>.

Searching for tag would result in e.g. The <script> <mark>tag</mark> is potentially dangerous, which wound hide the rest of the HTML page after "The".

Am I possibly missing something, or should the highlighter do the escaping?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions