Skip to content

fix: quote attribute values containing apostrophes correctly - #75

Open
vytenisu wants to merge 1 commit into
posthtml:masterfrom
vytenisu:fix/escape-single-quotes-in-attributes
Open

vytenisu wants to merge 1 commit into
posthtml:masterfrom
vytenisu:fix/escape-single-quotes-in-attributes

Conversation

@vytenisu

@vytenisu vytenisu commented Oct 5, 2026 •

Copy link
Copy Markdown

When a value is single-quoted (JSON-like values, quoteStyle: Single, or quoteStyle: Smart when the value contains "), a ' in it isn't escaped, so the output can be malformed HTML.

Such values are now double-quoted, with " escaped as ". All other output is unchanged, and tests cover all three cases.

When a value is single-quoted (JSON-like values, quoteStyle Single, or
quoteStyle Smart when the value contains `"`), a `'` in it isn't escaped,
so the output can be malformed HTML. Such values are now double-quoted,
with `"` escaped as ".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant