You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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
Hi @Andreas ,
Since you extensively use Cucumber you may want to consider AssertThat BDD & Test Management in Jira plugin which provides end-t-end BDD/cucumber solution. From interactive gherkin editor to test automation frameworks integration and uploading cucumber reports back to Jira.
More information can be found on the website and wiki.
Regards,
Glib
Thanks for the interesting suggestion, @Glib .
We're running JIRA on premises though and are currently not looking for additional tools in that technology stack.
@Andreas according to their documents it does https://prismjs.com/#languages-list
But on applying it with:
{code:gherkin}.. {code}
I get
Unable to find source-code formatter for language: gherkin. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
Which is only a fraction of the claimed supported formats.
Sorry - my bad, the Prism plugin was not properly installed. I was just getting regular Jira code macro functionality.