Geeks With Blogs
Liam McLennan

SyntaxHighlighter is the de facto standard for syntax highlighting on the web. I am currently working on a tool for publishing BDD specifications on the web and I want syntax highlighting. Unfortunately, SyntaxHighlighter does not support Gherkin, the language Cucumber and SpecFlow use to define BDD specifications. Writing new language parsers for SyntaxHighlighter is very easy, so I implemented one for Gherkin. Here is what a syntax highlighted Gherkin file looks like:

# A comment here

Feature: Some terse yet descriptive text of what is desired
	In order to realize a named business value
	As a explicit system actor
	I want to gain some beneficial outcome which furthers the goal

Scenario: Some determinable business situation
	Given some precondition
	And some other precondition
	When some action by the actor
	And some other action
	And yet another action
	Then some testable outcome is achieved
	And something else we can check happens too

Like all SyntaxHighlighter brushes to use this one you need to install the brush (shBrushGherkin.js). I have also used a custom theme to get it just the way I wanted it (shThemeGherkin.css). If you would like to use my Gherkin brush you may download the code and example page.

Posted on Tuesday, March 30, 2010 1:35 AM | Back to top

Copyright © Liam McLennan | Powered by: