Yesterday I worked on a cool addition required to develop syntax highlighting for things like Asciidoc.
Suppose you want to define lexical highlighting for Asciidoc you very likely have a rule like this:
lexical_highlighting { // ... rule __dftl_partition_content_type whitespace javawhitespace { // ... adoc_section_0 { single_line "= " } // ... } // ... }
But now suppose your asciidoc-File looks like this:
= This is a head line if a = b you're doing something wrong
the above rule would produce the following highlighting
which obivously is wrong. What our rule really has to express is
if a line starts with = (equal-sign) followed by a space
So the new addition I added the the ldef-DSL is that you can now define at which column in a line the rule has to start
lexical_highlighting { // ... rule __dftl_partition_content_type whitespace javawhitespace { // ... adoc_section_0 { single_line "= " col eq 0 } // ... } // ... }
and now the result looks ok
Thanks a lot, I have crossposted this information (with some context) to the Asciidoctor ML:
http://discuss.asciidoctor.org/How-can-we-make-better-AsciidocFX-td3109.html#a3745
There is already a JavaFX tool called “AsciidocFX” to work on Asciidoc files. Maybe they should use your StyledTextArea component.
With this extension, is it possible to build a “Compensator” tool to edit and preview Asciidoc files? From the screenshot I guess you have something like that.
Are the sources availlable? Or even better for me an exe to test?
Pingback: JavaFX links of the week, September 28 // JavaFX News, Demos and Insight // FX Experience