« Query custom function… | Home | SQL options applicabl… »

Configure Scintilla Control for HTML

Our ScintillaControlMBS can be configured to over 100 different lexers to colorize various texts. And today we configure the control for HTML:

Our plugin example comes with a file called LexerConstants.txt with all the constants. For the hypertext lexer we copy the SCE_H_* constants. Since HTML can have embedded JavaScript, VBScript, PHP and Python, we can also copy the following constants until SCE_HPHP_OPERATOR. For each of those styles you can define later an effective style with a specific color. Then we get the list of keywords for html and I just copied it from the html.properties file used for scite. There we can also see what styles the editor uses.

With PropertyNames method in our control you can learn the properties defined by the lexer and for folding html, we turn on the fold, fold.html and fold.hypertext.comment properties. You can do this dynamically if you like. For example query PropertyNames, build checkboxes for them and use DescribeProperty() to get a descriptive text for each property.

The example project will be included with 21.1pr2 in the next days and should be a good start for anyone looking into a good HTML text editor within Xojo. Below a screenshot from Windows as this project can run on macOS, Windows and Linux.

The list of lexers available for Scintilla in our plugin is:
a68k, abaqus, ada, apdl, as, asm, asn1, asy, au3, ave, avs, baan, bash, batch, bib, blitzbasic, bullant, caml, cil, clarion, clarionnocase, cmake, COBOL, coffeescript, conf, cpp, cppnocase, csound, css, d, dataflex, diff, DMAP, DMIS, ecl, edifact, eiffel, eiffelkw, erlang, errorlist, escript, f77, flagship, forth, fortran, freebasic, fsharp, gap, gui4cli, haskell, hollywood, hypertext, ihex, indent, inno, json, julia, kix, kvirc, latex, lisp, literatehaskell, lot, lout, lua, magiksf, makefile, markdown, matlab, maxima, metapost, mmixal, modula, mssql, mysql, nim, nimrod, nncrontab, nsis, null, octave, opal, oscript, pascal, powerbasic, perl, phpscript, PL/M, po, pov, powerpro, powershell, abl, props, ps, purebasic, python, r, raku, rebol, registry, ruby, rust, sas, scriptol, smalltalk, SML, sorcins, specman, spice, sql, srec, stata, fcST, TACL, tads3, TAL, tcl, tcmd, tehex, tex, txt2tags, vb, vbscript, verilog, vhdl, visualprolog, x12, xml, yaml, xojo.
04 02 22 - 11:26