highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

HAML syntax highlighting broken

Open j-erasmus opened this issue 2 years ago • 2 comments

Describe the issue HAML syntax highlighting is broken

Codepen

This issue was previously reported (https://github.com/highlightjs/highlight.js/issues/1435) and closed, but the issue does not seem to be fixed.

Screenshot 2023-05-08 at 15 07 12

Screenshot 2023-05-08 at 15 19 47

Which language seems to have the issue? HAML

Sample Code to Reproduce

!!! 5
%html
  %body
    %h1.foo-bar This works fine
    %span.hello.world syntax is fine here
    .broken{ broken: 'yes' }
    %anything.working{ working: 'fine' }
      .also-broken
      .i-am-broken
        .me-too
          %h1.good All good!

Expected behavior (Rouge example) Screenshot 2023-05-08 at 15 12 38

Additional context Same issue with HAML mixed with Ruby:

Screenshot 2023-05-08 at 15 17 50

j-erasmus avatar May 08 '23 13:05 j-erasmus

Screen Shot 2023-05-08 at 7 29 52 PM

I'm wondering if the . and % should be part of the match or not? (if not, probably punctuation?)

joshgoebel avatar May 08 '23 23:05 joshgoebel

We could take some inspiration from Rouge, they seem to make . and % part of the match, your example above looks good too (i.e. only make . part of the match).

Screenshot 2023-05-09 at 15 20 29

j-erasmus avatar May 09 '23 13:05 j-erasmus