on 06-Mar-2023 02:47
The provided iRule language definition can be used to highlight iRule code within websites using the Prism.js framework.
The Prism.js framework is widely used to highlight code blocks on websites. Even the DevCentral Page uses the Prism.js framework to highlight code boxes using the default TCL language definition contributed by Peter Chaplin to the Prism.js repository.
if { "1" equals "1" } then {
HTTP::path "/something"
pool some_pool
}
As you may see in the example above, the default TCL language definition is not trained to highlight any of the F5 specific commands (e.g. HTTP::path) and operators (e.g. equals), so that they remain non-highlighted in black color.
I took the time to write a language definition for iRules based on the reduced TCL 8.4 syntax supported by iRules in addition to the iRule command and operator set based on TMOS version 16.1.3.
I finally ended up with nearly 10kbyte RegEx signatures to provide a rich command highlighting experience for iRule code snippets.
Visit my GitHub Repository for additional implementation notes of the 'Prism.js language definition for iRules'.
Feel free to discuss the project here on CrowSRC!
Cheers, Kai
Visit: https://github.com/KaiWilke/F5-PrismJS-iRule-Language-Definition
Has this been submitted over at prisim.js ? It wont get into this forum until it is.