rouge-lexer-spl
A Rouge lexer plugin for Splunk's Search Processing Language (SPL). Rouge is the default syntax highlighter for Jekyll (and therefore GitHub Pages). This gem adds SPL support to Rouge.
Installation
Install the gem directly:
gem install rouge-lexer-splOr add it to your Gemfile:
gem 'rouge-lexer-spl'Then run:
bundle installUsage
Once installed, Rouge will automatically discover the lexer. You can use spl, splunk, or splunk-spl as the language tag in fenced code blocks:
```spl
index=web sourcetype=access_combined | stats count by status
```Jekyll / GitHub Pages
Add the gem to your site's Gemfile inside the :jekyll_plugins group:
group :jekyll_plugins do
gem "rouge-lexer-spl"
endRun bundle install, then use ```spl fences in your posts and pages. Jekyll will pick up the lexer automatically via Rouge's plugin discovery.
Colors
The lexer tells Rouge how to identify tokens. Rouge wraps each token in a span tag
with a class related to that token type. If you want to change how the tokens are
highlighted, change themes or add custom CSS.
Development
Install dependencies:
bundle installRun the test suite:
bundle exec rakeStart the visual preview server (available at http://localhost:9292):
bundle exec rake serverRun the terminal preview script:
ruby preview.rbEnable debug mode to print each token and its value:
DEBUG=1 ruby preview.rbIterative testing workflow
-
Run
bundle exec raketo check for test failures and error tokens. -
Start the server with
bundle exec rake server. -
In another terminal, check for error tokens in the rendered output:
curl -s http://localhost:9292 | grep 'class="err"'
-
Fix any error tokens in
lib/rouge/lexers/spl.rb. -
Repeat until no error tokens remain.
License
MIT