Skip to content

Add convertAttributeValues to allow parsing HTML attributes values#6741

Merged
artf merged 1 commit intodevfrom
allow-parser-html-attributes
Apr 7, 2026
Merged

Add convertAttributeValues to allow parsing HTML attributes values#6741
artf merged 1 commit intodevfrom
allow-parser-html-attributes

Conversation

@artf
Copy link
Copy Markdown
Member

@artf artf commented Apr 7, 2026

Adds a new HTML parser option, convertAttributeValues, to opt regular HTML attributes into the same value conversion already used by data-gjs-* component properties.

By default, regular attributes remain unchanged. When enabled, the parser can convert values like "true", "false", "[1,2,3]", and '{"key":"value"}' into their corresponding boolean, array, or object values.

Details

convertAttributeValues supports:

  • false by default: preserve current behavior
  • true: convert all regular attributes
  • string[]: convert only exact attribute names, for example ['src']
  • function: dynamically decide per attribute, for example:
    ({ attribute, node }) => attribute === 'src' && node.tagName.toLowerCase() === 'img'

@artf artf merged commit 054fd93 into dev Apr 7, 2026
3 checks passed
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