highlightjs / highlight.js

JavaScript syntax highlighter with language auto-detection and zero dependencies.
https://highlightjs.org/
BSD 3-Clause "New" or "Revised" License
23.3k stars 3.52k forks source link

fix: Expand allowed characters in keys #4044 #4045

Open uniqueeest opened 2 months ago

uniqueeest commented 2 months ago

Changes

This modification extends the definition of the key to include spaces, colon, slash, hyphen, and parentheses. It also changes the key to include more character types while maintaining the pattern that ends in colon.

Checklist

joshgoebel commented 1 month ago

How are you generating the expect file? All literal quotes need to be HTML escaped.

uniqueeest commented 1 month ago

@joshgoebel I wrote it.

expect-test

<span class="hljs-attr">"*":</span>

test

"*":

But it comes out like the picture I posted.

joshgoebel commented 1 month ago

Every " should be &quot; as the failing test is telling you. The output from Highlight.js must be HTML encoded.

uniqueeest commented 1 month ago

@joshgoebel Test file modification completed. It also passed without any problems.