Skip to content

HAML: re-use existing Ruby highlighter definition and add support for more filters

I went down a small rabbit hole while working on another open source project of mine.

This merge request changes removes the duplicated Ruby highlighter definitions from the HAML one and reuses the existing ones instead (less hardcoded and more consistent colours, yay!).

It also adds support for some special highlighting for filters, which is what HAML calls an indented block of code/text that will be passed through some function when it's rendered. Took me some time to get the contexts/rules for that one right, but I think it's fine now (my initial attempts were with a negative lookahead RegExpr, but for some reason that never changed the context when it matched).

Before After
Screenshot_2023-01-23_at_23.26.38 214163487-0ffba47b-0a51-4446-8087-abab9b692d02

Merge request reports