Skip to content

HTML comment of a single hyphen isn't tokenized correctly #523

@hrb-hub

Description

@hrb-hub
  • Comments containing noting but a single - are not terminated properly, causing actual markup to be commented out. Note that a double hyphen -- has the same effect.

To reproduce

import linkifyHtml from 'linkify-html';

function main() {
	const html = `<div><!----->Markup</div>`
	const result = linkifyHtml(html, {defaultProtocol: "https"})

	console.log({html, result})
}

main()

See that the output of linkifyHtml("<div><!----->Markup</div>", {defaultProtocol: "https"}) is "<div><!-----&gt;Markup&lt;/div&gt;-->"

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