Since we started using Cucumber for various projects, we felt the need for a nice representation of Gherkin code within Confluence.
So I created a custom gherkin brush file based on the SyntaxHighlighter manual and added it to the Code Macro:
SyntaxHighlighter.brushes.Custom = function()
{
this.regexList = [
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // #comments
{ regex: /(['\"]{3})([^\1])*?\1/gm, css: 'string' }, // multi-line strings like in python with """
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
{ regex: /@.*$/gmi, css: 'color1' }, // @tags
{ regex: /^\s*(But |And |Then |When |Given |Scenarios|Examples|Scenario Template|Scenario Outline|Scenario|Background|Feature)/gmi, css: 'keyword' } // english
];
};
SyntaxHighlighter.brushes.Custom.aliases = ['gherkin'];
SyntaxHighlighter.brushes.Custom.prototype = new SyntaxHighlighter.Highlighter();
It currently looks ok but I wonder if someone from the community uses a similar/ better solution for that.
Feel free to use this, btw: gist