Skip to content
This repository was archived by the owner on Sep 7, 2024. It is now read-only.
This repository was archived by the owner on Sep 7, 2024. It is now read-only.

Img attributes with single quotes result in invalid tags #19

Description

@vegetabill
var trunc = require("html-truncate")
trunc("<p>osito<img src='http://example.com/img.jpg' width='100'/>oscuro</p>", 8)

Results in:

'<p>osito<im…</p>'

Note the truncated img tag. I tried it with and without keepImageTag and it didn't make a difference.

When you use double quotes for the src and width attributes, it behaves as expected. I tried the example with html-ellipsis and the above works as expected, preserving the img tag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions