Skip to content

HTML attributes not highlighted if unquoted #173

@edent

Description

@edent

Tempest version

2.11.4

PHP version

8.4

Operating system

Linux

Description

Consider this HTML:

<img class="a" alt src=example.png>

This library only highlights the attribute "class".

&lt;<span style="color: #0000ff;">img</span> <span style="color: #795E26;">class</span>=&quot;a&quot; alt src=example.png&gt;

HTML only requires attribute values to be quoted if they contain a space, equals sign, or a few other characters. See https://html.spec.whatwg.org/multipage/syntax.html#attributes-2

So, in this case the empty alt and the unquoted src should both be highlighted.

Steps to reproduce

echo $highlighter->parse( '<img class="a" alt src=example.png>', "html" );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions