Coloring In-line HTML

I’m just getting started with Komodo, found it in a search for an IDE which would support all the languages I use plus Git for version control, looks like it fits the bill.

I do a lot of perl development for CGI. And I generally use long prints for my HTML. Is there a way to get HTML (& maybe js) syntax highlighting within a long text block, the default single color highlighting isn’t very helpful.


Not sure what you mean exactly by “within a long text block” but Komodo uses your file extension to automatically detect the language. If you create a new file and have not saved it or if your file extension is not recognized by Komodo you can change the language manually by selecting it in the center of your statusbar (bottom of screen), it will likely just say “Text” for you right now.

Thanks for the reply, I’ll be more clear. For this example I’m editing a perl file, I want perl syntax highlighting for the main code, however I have a block of code like this within my script:

print <<EOHTML;
<tr><th>This is an HTML Table</th></tr>
<tr><td>This is some content within the table</td></tr>

So within that block (between the <<EOHTML; and the EOHTML) I would like the syntax highlighting to switch from Perl mode to HTML mode. Is this possible with Komodo?

@cstephens: Komodo is capable of doing precisely that, as I am doing something similar in a UDL-based language mode I wrote and continue to maintain for CFML. In that mode, I switch from CFML syntax highlighting into SQL highlighting when I find cfquery tags and drop back out to CFML when I find the closing tag. It is much the same as when Komodo’s HTML mode finds CSS or JavaScript in an HTML mode. I use similar transitions to get in and out of HTML, CSS, JavaScript, SQL, and CFScript syntax all within a CFML file. I even do SQL syntax highlighting within "-quoted strings in certain contexts and limited CFML syntax highlighting within "- and '-quoted strings in certain contexts.

You could do something similar with perl but I am guessing you would have to write your own perl mode and you would probably need to restrict it to some sort of convention to define the start and end of your here-documents containing HTML, etc., as there could be more than one in a given perl file and there may also be here-documents that you don’t want treated that way in terms of syntax highlighting (I could easily envision similar handling of SQL here-documents denoted by EOSQLxxx begin/end pairs, for instance).

@nathanr and the other Komodo wizards may have other thoughts on an approach. Possible? Yes. Conceptually straightforward? Yes, once you get your head around how powerful Komodo’s UDL-based state machines can be for syntax highlighting. Going to take a bit of work? Yeah, probably. If I were going to try something like that, I would definitely want to start with the source for Komodo’s perl language support as a starting point if that was at all possible.

Yes, like @rstewart says, UDL is Komodo’s solution for combining (styling) multiple languages in one file. It would be similar to Komodo’s Smarty, or Mojolicious support (perl web frameworks) that use UDL to combine Perl and HTML.


Are there some docs you guys could point me to that would get me started setting that up?

post in ActiveState blog (out of date, but contains some useful information)
Docs: udl