== Code Highlighter Rouge _Rouge_ is a pure Ruby and themeable syntax highlighter. It can highlight 100+ different languages and output HTML or ANSI 256-color text. Find all available themes and examples for several languages of how highlighting works using _Rouge_. For the default theme `Uno` of J1 Theme, the following _Rouge_ themes are used: * light: `igorpro` * dark: `monokai.sublime` NOTE: The default themes used for the J1 Theme can be configured with the global template config file `~/_data/j1_config.yml`. === Apply a theme Make a selection of a theme below to preview. ++++
++++ === Highlight Liquid code {% raw %} [source, liquid] ---- Hello {{ 'now' | date: "%Y %h" }} {% comment %} if item.quantity is 4... {% endcomment %} {% for i in (1..item.quantity) %} {{ i }} {% endfor %} ---- {% endraw %} === Highlight Javascript code [source, javascript] ---- // helper functions // function styleSheetLoaded(styleSheet) { var sheets = document.styleSheets, stylesheet = sheets[(sheets.length - 1)]; // find CSS file 'styleSheetName' in document for(var i in document.styleSheets) { if(sheets[i].href && sheets[i].href.indexOf(styleSheet) > -1) { return true;; } } } ---- === Highlight Ruby code [source, ruby] ---- require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal' include Asciidoctor <1> Asciidoctor::Extensions.register do class J1BlockMacro < Extensions::BlockMacroProcessor use_dsl named :banner name_positional_attributes 'role' def process parent, target, attrs html = %(
) create_pass_block parent, html, attrs, subs: nil end end block_macro J1BlockMacro end ---- <1> don't miss to load the Asciidoctor ruby