[NTG-context] Custom syntax highlighting

Hans Hagen pragma at wxs.nl
Tue Mar 1 22:53:10 CET 2016


On 3/1/2016 4:26 PM, Nicola wrote:
> I'm using the latest beta, and I need syntax coloring for SQL
> (PostgreSQL variant). According to the wiki, there is no SQL
> syntax coloring available for MKIV yet, but I'd be happy to
> be wrong :)
>
> If I am not wrong, I'd like to write my own syntax file, but
> not starting from scratch. I cannot find any pret-* files in
> the beta, though. Should they be downloaded separately?

just fyi (as aditya already provided you a solution) there are three 
highlighters

- the build-in one, for which one can define additional variants (there 
are few defined, some assume proper syntax, some are line based)

- the module by aditya which (i assume) also needs vim installed

- a relative new mechanism based on the scite lexers that i use (for not 
it is loaded by \usemodule[scite]

The last option is supports combined tex/mp/lua as well as xml, web, 
pdf, bibtex, lua so basically all the formats used by context and
i now also added the sql one (i needed that one a while ago but never 
added it to the upcoming beta)

\usemodule[scite]

\starttext

% \scitebuffer[sql][x]
% \scitefile[sql][abc.sql]

\startscite[sql]
....
\stopscite

\stoptext

no upload yet

btw, there's also:

mtxrun --extra=listing --scite --compact foo.sql

or whatever known suffix

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list