Sublime Forum

Custom event attributes in HTML.sublime-syntax

#1

Hi guys,

I am developing my own HTML template processor and I want my custom attributes to be highlighted as event attributes (embedded js).

In HTML.sublime-syntax file I found section “tag-event-attribute:” and added my attribute in it, but it does not work for me.

Could you please help me and point to places where I should edit and what.

Thanks!

0 Likes

#2

editing the HTML.sublime-syntax file in the way you describe works for me - I added ontesting123 as a custom event, and it highlights the contents/value of that attribute as JavaScript (tested on an a tag).

Are you using https://packagecontrol.io/packages/PackageResourceViewer to edit the file?
or have you symlinked any package folders? if so, you may need to restart ST before it detects the updated syntax definition

that said, if you want to make your changes public, maybe there is a case for getting the HTML syntax to treat any attributes starting with on as events (but to keep the known/named ones scoped differently to know they are definitely valid)

0 Likes

#3

Hi,

Yes, I use PackageResourceViewer, still does not work for me, I’ve tried everything, reopening, cleaning ST cache…

Anyway, suspended that issue for now… will get back to it later

Thanks for reply!

0 Likes