Syntax Processor Documentation

[ Syntax Anywhere ]

Syntax Processor Plugins

Syntax Anywhere blocks provide syntax highlighting using plugin classes.

Functionality can be extended by adding plugin classes for additional Syntax Processors. Syntax Processor plugins are simple classes that provide the functionality to adapt Syntax Anywhere to alternative highlighting code. They should inherit from SyntaxPluginBase. Details are provided by comments in the code.

Plugins can be added by placing the plugin classes at packages/anyPackageName/src/SyntaxAnywhere/SyntaxProcessors/PluginName or application/src/SyntaxAnywhere/SyntaxProcessors/PluginName. Plugins can also be similarly placed beneath any namespace declared in a package controller's AutoloaderRegistries.

[ Syntax Anywhere ]

Ace

Ace syntax editor, in read only mode.

The Ace syntax editor is loaded from the concrete5 core and used to display code in read only mode. This can be usefull for languages with unusual structure such as assembler and SQL. The Languages need to be set manually.

Ace is pretty good at picking out and processing html <tags>, so you are unlikely to need to set the option to escape html tags before processing.

Ace automatically acquires the background colour of its container, so unless you want to override the theme background, its best not to set a background colour.

Ace requires the language to be set. You can set a default language in the edit dialog and where necessary override that with an attribute languages="html" on the wrapper for the code fragment. Languages available are: abap, actionscript, ada, apache_conf, asciidoc, assembly_x86, autohotkey, batchfile, c_cpp, c9search, cirru, clojure, cobol, coffee, coldfusion, csharp, css, curly, d, dart, diff, django, dot, ejs, erlang, forth, ftl, gherkin, glsl, golang, groovy, haml, handlebars, haskell, haxe, html, html_completions, html_ruby, ini, jack, jade, java, javascript, json, jsoniq, jsp, jsx, julia, latex, less, liquid, lisp, livescript, logiql, lsl, lua, luapage, lucene, makefile, markdown, matlab, mel, mushcode, mushcode_high_rules, mysql, nix, objectivec, ocaml, pascal, perl, pgsql, php, plain_text, powershell, prolog, properties, protobuf, python, r, rdoc, rhtml, ruby, rust, sass, scad, scala, scheme, scss, sh, sjs, smarty, snippets, soy_template, space, sql, stylus, svg, tcl, tex, text, textile, tmsnippet, toml, twig, typescript, vbscript, velocity, verilog, vhdl, xml, xquery, yaml.

The license for ace.js is BSD.

[ Syntax Anywhere ]

Diagnostic

Diagnostic. Not a syntax processor!

Rather than processing the data passed to the syntax processor, escapes it and outputs the escaped data as a diagnostic. Can be useful when developing further syntax processors.

[ Syntax Anywhere ]

Highlight

JavaScript based prettifier highlight.js, as used on concrete5.org.

Highlight.js JavaScript and themes are loaded from CDNJS Cloudflare. Most languages are automatically detected.

More information is available at https://highlightjs.org/usage/.

Languages currently provided by highlight.js are: Apache, Bash, C#, C++, CSS, CoffeeScript, Diff, HTML, XML, HTTP, Ini, JSON, Java, JavaScript, Makefile, Markdown, Nginx, Objective-C, PHP, Perl, Python, Ruby, SQL, Shell Session.

Further languages can be pulled in by adding a language="language_name" hint in the syntax anywhere marker. Further languages available are: 1c, abnf, accesslog, actionscript, ada, angelscript, applescript, arcade, arduino, armasm, asciidoc, aspectj, autohotkey, autoit, avrasm, awk, axapta, basic, bnf, brainfuck, cal, capnproto, ceylon, clean, clojure-repl, clojure, cmake, coq, cos, crmsh, crystal, csp, d, dart, delphi, django, dns, dockerfile, dos, dsconfig, dts, dust, ebnf, elixir, elm, erb, erlang-repl, erlang, excel, fix, flix, fortran, fsharp, gams, gauss, gcode, gherkin, glsl, gml, go, golo, gradle, groovy, haml, handlebars, haskell, haxe, hsp, htmlbars, hy, inform7, irpf90, isbl, jboss-cli, julia-repl, julia, kotlin, lasso, ldif, leaf, less, lisp, livecodeserver, livescript, llvm, lsl, lua, mathematica, matlab, maxima, mel, mercury, mipsasm, mizar, mojolicious, monkey, moonscript, n1ql, nimrod, nix, nsis, ocaml, openscad, oxygene, parser3, pf, pgsql, plaintext, pony, powershell, processing, profile, prolog, properties, protobuf, puppet, purebasic, q, qml, r, reasonml, rib, roboconf, routeros, rsl, ruleslanguage, rust, sas, scala, scheme, scilab, scss, smali, smalltalk, sml, sqf, stan, stata, step21, stylus, subunit, swift, taggerscript, tap, tcl, tex, thrift, tp, twig, typescript, vala, vbnet, vbscript-html, vbscript, verilog, vhdl, vim, x86asm, xl, xquery, yaml, zephir

Highlight is pretty good at picking out and processing html <tags>, so you are unlikely to need to set the option to escape html tags before processing.

The option to dominate background will spread whatever background the highlight theme provides out to the overall wrapper Syntax Anywhere places about syntax formatted sections. The option to inherit background does the opposite, replacing the background provided by the theme with that provided by Syntax Anywhere.

The license for highlight.js is BSD.

[ Syntax Anywhere ]

None

Apply no highlighting or line numbering.

Wraps and escapes everything and implements colour settings, but no line numbers or anything else.

[ Syntax Anywhere ]

Prettify

JavaScript based prettifier from Google, as used by Google and Stackoverflow.

Prettify.js JavaScript and the default theme css are loaded from CDNJS. Other themes are bundled with this addon, sourced from both https://github.com/google/code-prettify and https://jmblog.github.io/color-themes-for-google-code-prettify/. Languages are automatically detected.

More information is available at https://github.com/google/code-prettify.

Prettify leaves html <tags> intact. When processed and written back to the page this could have undesirable side effects, especially when script tags are involved and the consequence could be a fatal JavaScript error. It is usually best to leave the escape html tags option set for this syntax processor.

Languages built in to prettify.js are: Bash, C, C#, C++, HTML, Java, JavaScript, Perl, Python, Ruby, Shell, XHTML, XML, XSL and other C-like syntaxes including PHP and CSS.

Further languages can be pulled in by adding a language="language_name" hint in the syntax anywhere marker. Further languages available are: apollo, basic, clj, css, dart, erlang, go, hs, lisp, llvm, lua, matlab, ml, mumps, n, pascal, proto, r, rd, scala, sql, tcl, tex, vb, vhdl, wiki, xq, yaml

The option to dominate background will spread whatever background the prettify theme provides out to the overall wrapper Syntax Anywhere places about syntax formatted sections. The option to inherit background does the opposite, replacing the background provided by the theme with that provided by Syntax Anywhere.

The license for Prettify.js is Apache 2.0. The licenses for themes are Apache 2.0 for themes provided with prettify.js and MIT for the additional themes.

[ Syntax Anywhere ]

Prettify Local

Prettify, with all assets provided by the web server, not from a CDN.

This version of prettify uses assets held on the web server, not from a CDN, so is suitable for sites that prefer to avoid CDN dependancies. Prettify.js JavaScript and the all themes css are bundled with this addon, sourced from both https://github.com/google/code-prettify and https://jmblog.github.io/color-themes-for-google-code-prettify/. Languages are automatically detected.

More information is available at https://github.com/google/code-prettify.

Prettify leaves html <tags> intact. When processed and written back to the page this could have undesirable side effects, especially when script tags are involved and the consequence could be a fatal JavaScript error. It is usually best to leave the escape html tags option set for this syntax processor.

The option to dominate background will spread whatever background the prettify theme provides out to the overall wrapper Syntax Anywhere places about syntax formatted sections. The option to inherit background does the opposite, replacing the background provided by the theme with that provided by Syntax Anywhere.

The license for Prettify.js is Apache 2.0. The licenses for themes are Apache 2.0 for themes provided with prettify.js and MIT for the additional themes.

[ Syntax Anywhere ]

Prism

Lightweight prettifier prism.js, requires language to be specified.

rism.js JavaScript and themes are loaded from CDNJS.

More information is available at http://prismjs.com/.

Prism.js requires all languages to be explicityly specified. Each code block needs to hint the language used by adding a language="language_name" hint in the syntax anywhere marker. If not, it will be defaulted to php. Languages pre-loaded are C and similar, css, html, javascript, php. Further languages loaded on demand are: actionscript, apacheconf, applescript, aspnet, autohotkey, bash, c, coffeescript, core, cpp, csharp, css-extras, dart, eiffel, erlang, fortran, fsharp, gherkin, git, go, groovy, haml, handlebars, haskell, http, ini, jade, java, jsx, julia, latex, less, lolcode, markdown, matlab, nasm, nsis, objectivec, pascal, perl, powershell, python, r, rest, rip, ruby, rust, sas, scala, scheme, scss, smalltalk, smarty, sql, stylus, swift, twig, typescript, wiki, yaml

Prism is pretty good at picking out and processing html <tags>, so you are unlikely to need to set the option to escape html tags before processing.

The option to dominate background will spread whatever background the prism theme provides out to the overall wrapper Syntax Anywhere places about syntax formatted sections. The option to inherit background does the opposite, replacing the background provided by the theme with that provided by Syntax Anywhere.

The license for prism.js is MIT.

[ Syntax Anywhere ]

Simple Lines

Very simply provide zebra striping and line numbers.

A minimal formatter involving no external resources, so fast to render and universally available. Simply wrap lines into a list with or without line numbers and with a hint of zebra striping.