I am working with a language called Webclerk, which uses custom tags to query a 4D database. It works similarly to PHP. Instead of a .php
file which is processed into HTML, this uses a '.wc' file which is processed into HTML.
Instead of something like: <?php echo $variable; ?>
, it would look like _jit_ echo $variable; jj
<?php
= _jit_
, ?>
= jj
.
In Sublime Text, when PHP is selected as the Syntax, PHP is highlighted a different block color, on top of the HTML highlighting. I'd like to do the same thing for these special tags.
I really don't care about highlighting text inside the brackets. I would be completely satisfied with just having a highlight/background color starting and stopping with the tags.
I have installed Package Manager, and Package Resource Viewer, then extracted the PHP and the HTML packages to examine them. I've been going through tutorials as well. I'm running into a problem with the two different types of syntax highlighting (.tmLanguage vs .sublime-syntax). There is a lot of info on the first way, and very little on the second. I feel like just starting and stopping highlighting based on two tags can't be that difficult.
When I opened the HTML package, I get:
Comments.tmPreferences
HTML.sublime-syntax
Miscellaneous.tmPreferences
Symbol List - ID.tmPreferences
encode_html_entities.py
html.sublime-snippet
html_completions.py
Almost none of these are mentioned in tutorials. I tried just changing the names of HTML to Webclerk, and I did manage to get a new Syntax in the list. But when I edited tags, nothing changed in what was highlighted.
I'm wondering if I can get some pointers on where to start, on what these files mean, and potentially any examples where people have extended HTML before.
basically you're trying to define a custom scope with a start & end regexp selectors that is documented here: http://sublimetext.info/docs/en/extensibility/syntaxdefs.html#begin-end-rules
I have also ran into this intresting discussion on the sublime text board from somebody trying to do exactcly what you're trying to do http://www.sublimetext.com/forum/viewtopic.php?f=6&t=6207 There is some helpful information and tips in it.
I would start in the HTML.sublime-package
package inside HTML.tmLanauage
package on line 598 (in my setup) there is a definition for php start & end tags, it looks like a regex that recognizes the tags and highlights them
BTW .sublime-package
are just zip files, you can rename them and extract.
then put the extracted folder inside %APPDATA%\Sublime Text 3\Installed Packages
to run it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With