Rouge is a pure Ruby library for syntax highlighting and is fully supported by Jekyll. The library is integrated with the J1 Theme and supports 100+ script and programming languages. Multiple styles are available to customize the highlighter for light or dark J1 Themes.
Find available themes for selected languages to see how highlighting works using Rouge.
Select a Theme
For the default themes Uno
of J1 Template, the following Rouge themes are used:
-
theme_light: based on theme
igorpro
-
theme_dark: based on theme
monokai.sublime
The default themes used for the J1 Template can be configured with the global template config file ~/_data/j1_config.yml
.
# ------------------------------------------------------------------------------
# HIGHLIGHTERs
#
rouge:
theme_light: uno.light
theme_dark: uno.dark
To preview all themes supported by J1 Template, make your selection from the button AVAILABLE THEMES below.
Examples
Find a selected number languages (code blocks) and their highlightning using a selected theme.
Liquid
Hello {{ 'now' | date: "%Y %h" }}
{% comment %}
if item.quantity is 4...
{% endcomment %}
{% for i in (1..item.quantity) %}
{{ i }}
{% endfor %}
{% comment %} results in 1,2,3,4 {% endcomment %}
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;;
}
}
}
Ruby
# Load Asciidoctor extensions needed
#
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 = %(<div id="#{target}" class="#{attrs['role']}"></div>)
create_pass_block parent, html, attrs, subs: nil
end
end
block_macro J1BlockMacro
end
1 | don’t miss to load the Asciidoctor ruby |
Attributes
You can further customize the source block output with additional Rouge attributes.
Attribute | Description |
---|---|
| Controls what method is used for applying CSS to the tokens. Can be |
| Sets the name of the Rouge color theme to use. Look into lib/rouge/themes in the Rouge repository for a list of available themes. Default is |
| Alternative name for the |
| CSS class to use on a line wrapper element for highlighted lines. Default is |
| CSS class to set on a line wrapper element Default is |
| Format string for specifying an HTML |
Languages
Here the list of the (current of Feb, 2022) supported languages and lexers (language highlighters).
A - B
Language | Alias | Description |
---|---|---|
| abap | The Advanced Business Application Programming Platform language of SAP. |
| as,as3 | ActionScript |
| apache | Configuration files for the Apache web server. |
| apib | Markdown based API description language. |
| applescript | The AppleScript scripting language by Apple Inc. |
| awk | Pattern-directed scanning and processing language |
| biml | BIML, Business Intelligence Markup Language |
| brainfuck | The Brainfuck programming language. Brainfuck is one of the most famous esoteric programming languages, and has inspired the creation of a host of other languages. |
| bsl | The 1C:Enterprise programming language |
C - D
Language | Alias | Description |
---|---|---|
| c | The C programming language |
| ceylon | Say more, more clearly. |
| cfc | CFScript, the CFML scripting language |
| clj,cljs | The Clojure programming language, a general-purpose programming language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming. |
| cmake | The cross-platform, Open Source build system |
| coffee,coffee-script | The Coffeescript programming language |
| cl,common-lisp,elisp,emacs-lisp | The Common Lisp language, a variant of Lisp having excellent support for object oriented programming, and fast prototyping capabilities. |
| config,configuration | A generic lexer for configuration files |
| terminal,shell_session,shell-session | A generic lexer for shell sessions. Accepts ?lang and ?output lexer options, a ?prompt option, and ?comments to enable comments. |
| coq | The Coq is a formal proof management system. It provides a formal language to write mathematical definitions, executable algorithms and theorems together with an environment for semi-interactive development of machine-checked proofs. |
| c++ | The C++ programming language |
| cr | The Crystal Programming Language. Have a syntax similar to Ruby but’s not Ruby. |
| c#,cs | A multi-paradigm language targeting .NET. |
| css | Cascading Style Sheets, used to style web pages |
| dlang | The D programming language, a general-purpose programming language with static typing, systems-level access, and C-like syntax. |
| dart | The Dart programming language, a client-optimized language for fast apps on any platform. |
| patch,udiff | Lexes unified diffs or patches. |
| digdag | The digdag engine. A simple, open source, multi-cloud workflow engine. |
| dockerfile | The Dockerfile syntax |
| dot | A graph description language |
E - G
Language | Alias | Description |
---|---|---|
| eiffel | The Eiffel programming language, the most comprehensive approach to the construction of successful object-oriented software. |
| exs | The Elixir language, designed for building scalable and maintainable applications. |
| elm | The Elm language, programming delightful data visualization. |
| eruby,rhtml | Embedded Ruby template files |
| erl | The Erlang programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. |
| esc | A generic lexer for including escaped content. |
| factor | A Factor practical stack-based programming language with high-level features including dynamic types, extensible syntax, macros, and garbage collection. |
| fortran | The Fortran (2008) language |
| fsharp | The F# functional programming language |
| cucumber,behat | The DSL Gherkin, a business-readable spec DSL |
| glsl | The GLSL the principal shading language for OpenGL. |
| golang | The Programming language Go programming language. Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. |
| gradle | A powerful build system for the JVM. From mobile apps to microservices, from small startups to big enterprises, Gradle helps teams build, automate and deliver better software, faster. |
| graphql | The GraphQL query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time,and enables powerful developer tools. |
| groovy | The Apache Groovy programming language is a powerful, optionally typed and dynamic language, with static-typing and static compilation capabilities, for the Java platform. Aimed at improving developer productivity thanks to a concise, familiar and easy to learn syntax. It integrates smoothly with any Java program, and immediately delivers to your application powerful features, including scripting capabilities, Domain-Specific Language authoring, runtime and compile-time meta-programming and functional programming. |
H - I
Language | Alias | Description |
---|---|---|
| hh | The Hack programming language. Hack reconciles the fast development cycle of a dynamically typed language with the discipline provided by static typing, while adding many features commonly found in other modern programming languages. |
| haml | The Haml templating system for Ruby. Haml (HTML abstraction markup language) is based on one primary principle: markup should be beautiful. It’s not just beauty for beauty’s sake either. |
| hbs,mustache | The Handlebars and Mustache templating languages. |
| hs | The Haskell programming language, for advanced and purely functional programming. |
| hcl | The Hashicorp Configuration Language, used by Terraform and other Hashicorp tools. |
| html | The HTML markup language, the markup language of the web. |
| http | The Lexer for http requests and responses. |
| hy | The HyLang programming language. Hy is a Lisp dialect that’s embedded in Python. Since Hy transforms its Lisp code into Python abstract syntax tree (AST) objects, you have the whole beautiful world of Python at your fingertips, in Lisp form. |
| idlang | IDLang, the Interactive Data Language (IDL). IDL is a high-level language for data manipulation, visualization and analysis. IDL has strong signal and image processing capabilities and extensive math and statistical functions. |
| igorpro | The WaveMetrics Igor Pro interactive software environment. |
| ini | The INI configuration format. |
| io | The IO programming language. |
| pry |
J - L
Language | Alias | Description |
---|---|---|
| java | The Java programming language. |
| js | The JavaScript language, the browser scripting language. |
| django | The Django/Jinja template engine. Jinja is a modern and designer-friendly templating language for Python, modelled after Django’s templates. |
| json | JSON, the JavaScript Object Notation. JSON is a lightweight data-interchange format, specidied for the programming language Javascript. It is easy for humans to read and write. It is easy for machines to parse and generate |
| json-doc | A JSON flavour with extenstions for documentation. |
| jsonnet | The language Jsonnet is an elegant, formally-specified config language for JSON |
| jsp | JSP, the JasperJSP Engine (Apache Tomcat) language specification Java Server Pages. Jasper parses JSP files to compile them into Java code as servlets. |
| react | For React, a Javascript-based framework to create UI-components for web development, JSX is a template/tagging specification to produce React elements from. |
| jl | The Julia programming language. Julia is dynamically typed, feels like a scripting language, and has good support for interactive use. The language has a domain in Data Visualization and Plotting. |
| kotlin | The Kotlin programming language. Kotlin is a modern programming language to replace JAVA-code on JAVA virtual machine (JVM). |
| lassoscript | The Lasso programming language. Lasso bridges the gap between popular web servers, data sources (databases), and various other communication tools, utilities, and protocols such as email, directory services (LDAP, Active Directory), web services (SOAP, XMLRPC), and PDF generation. |
| liquid | The Liquid markup language. Liquid is a templating engine for Ruby, developed by the makers of Shopify, a professional ecommerce website backed. |
| litcoffee | The Literate coffeescript is an implementation of literate programming (combining code and documentation) to extend Haskell for the generation of Markdown-based documentation from CoffeeScript programming code. |
| lithaskell,lhaskell,lhs | The Literate haskell is an implementation of literate programming (combining code and documentation) for the Haskell proframming language. The tool used to generate hyperlinked documentation from literate code is Haddock. |
| llvm | The LLVM Compiler Infrastructure is a collection of modular and reusable compiler and toolchain technologies. |
| lua | The Lua language. Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description. |
M - N
Language | Alias | Description |
---|---|---|
| m68k | The language Motorola 68k Assembler is the (near hardware) coding language for (the quite old) Motorola 68k processors used for the first personal computer like Amiga, Atari or the first Macintosh PCs from Apple. |
| magik | The Smallworld Magik, an object-oriented programming language that supports multiple inheritance and polymorphism, and it is dynamically typed. It was designed and implemented in 1989 by Arthur Chance of Smallworld Systems Ltd.. Magik is still a part of the Smallworld technology platform. |
| makefile,mf,gnumake,bsdmake | Code highlighter for the Makefile syntax. Make is a Unix utility, but is available on other platform as well (Linux, Apple OSX or Windows). Make exists in several flavours, is a code build utility for applications based on the programming language C or C++ (C PlusPlus). The Makefile defines the processing chain to compile a program from the sources to an executable. |
| md,mkd | The markup language https://daringfireball.net/projects/markdown/[Markdown is a light-weight language for authors to write formatted text using a simple plain-text editor. Markdown code is convert it to structurally valid XHTML or HTML to be displayed in web browsers. |
| wl | Wolfram Mathematica the world’s definitive system for modern technical calculation and computing. |
| m | The Matlab language is used by MATLAB programming platform, designed specifically for engineers and scientists. The heart of MATLAB is the MATLAB language, a matrix-based language allowing the most natural expression of computational mathematics. |
| moon | the Moonscript language is a dynamic scripting language that compiles into Lua. It gives the power of one of the fastest scripting languages combined with a rich set of features. |
| mosel | The language Mosel is an optimization language used by Fico Xpress. Mosel is an environment for modeling and solving problems that is provided either in the form of libraries or as a standalone program. Mosel includes a language that is both a modeling and a programming language combining the strengths of these two concepts. |
| mxml | The MXML markup language is an XML-based user interface markup language that renders and describes graphical user interfaces and controls, first introduced by Macromedia. Application developers use MXML in combination with ActionScript to develop rich Internet applications. |
| nasm | The assembler language Netwide Assembler is used for the (Intel) x86 CPU architecture. Portable to nearly every modern platform, and with code generation for many platforms old and new. |
| nginx | Hightlights the configuration files for the web server NGINX. NGINX is a high performance Load Balancer and Web Server accelerates content and application delivery, improves security, facilitates availability and scalability for the busiest web sites on the Internet. |
| nimrod | The Nim programming language (https://nim-lang.org/). Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. |
| nixos | The Nix expression language. Nix is a tool that takes a unique approach to package management and system configuration for reproducible builds and deployments. |
O - P
Language | Alias | Description |
---|---|---|
| objc,obj-c,obj_c | The language ObjectiveC is an extension of C commonly used to write Apple software. |
| ocaml | The language Objective Caml is an industrial-strength programming language supporting functional, imperative and object-oriented styles. |
| pascal | The language Pascal is a procedural programming language commonly used as a teaching language learning programming techniques for computers. |
| pl | The Perl scripting language. Perl is a highly capable, feature-rich programming language with over 30 years of development. |
| php3,php4,php5 | The PHP scripting language. PHP is a popular general-purpose scripting language that is especially suited to web development. Fast, flexible and pragmatic. PHP powers everything from your blog to the most popular websites in the world. |
| text | A boring lexer that does not highlight anything |
| plist | A highlighter for plist preference files for appliactions on Apple platforms. |
| posh,microsoftshell,msshell | The PowerShell is a shell (run-time interpreter for terminal sessions) and a task automation and configuration management framework for Microsoft Windows server and client systems. Unlike most shells (e.g on Unix/Linux) which accept and return simple text, PowerShell is built on top of the .NET Common Language Runtime. |
| praat | The Praat scripting language, used for doing computer-based phonetics. |
| prolog | The Prolog programming language. Prolog is a logic programming language associated with artificial intelligence and computational linguistics. |
| prometheus | Prometheusis an Open Source monitoring solution that provides a functional query language called PromQL (Prometheus Query Language) that lets the user select and aggregate time series data in real time. |
| properties | Higlighter for JAVA .properties config files. |
| proto | Google’s ProtoBuf Protocol buffers is a language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. |
| pp | The Puppet configuration management language. Puppet is a software configuration management system for the automatisation for typical administration tasks to manage operating systems. |
| py | The Python programming language. Python is an interpreted, object-oriented, high-level programming language. |
| kdb+ | The Q programming language. Q serves as the query language for kdb+, a disk or in-memory, column-based database. |
Q - S
Language | Alias | Description |
---|---|---|
| qml | The QML markup language. QML (Qt Modeling Language) is a user interface markup language. It is a declarative language (similar to CSS and JSON) for designing user interface–centric applications. |
| s | The R statistics language. R is a free software environment for statistical computing and graphics. |
| racket | The Racket language is a general-purpose, multi-paradigm programming language based on the Scheme dialect of Lisp. It is designed to be a platform for programming language design and implementation. |
| rb | The Ruby programming language. |
rust | rs,no_run,ignore,should_panic | The Rust programming language. |
| scss | The Sass stylesheet language language. |
| scala | The Scala programming language. |
| scheme | The Scheme variant of Lisp. |
| sed | sed, the ultimate stream editor. |
shell | bash,zsh,ksh,sh | Lexer for various shell languages, including sh and bash. |
| sieve | Mail filtering language |
| slim | The Slim template language. |
| st,squeak | The Smalltalk programming language. |
| smarty | Smarty Template Engine. |
| ml | Standard ML. |
| sqf | Status Quo Function, a Real Virtuality engine scripting language. |
| sql | Structured Query Language, for relational databases |
| supercollider | A cross-platform interpreted programming language for sound synthesis, algorithmic composition, and realtime performance. |
| swift | The language Swift is a multi paradigm, compiled programming language developed by Apple for iOS and OSX development. |
T - Z
Language | Alias | Description |
---|---|---|
| tap | Test Anything Protocol. |
| tcl | |
| tf | Terraform HCL Interpolations. |
| latex | The TeX typesetting system |
| toml | The TOML configuration format. |
| tsx | TSX allows for embedding JSX elements inside the file, and is largely used by React. |
| tulip | The Tulip programming language (twitter.com/tuliplang). |
| turtle | Terse RDF Triple Language, TriG |
| twig | The Twig template engine. Twig is a modern template engine for PHP. |
| ts | TypeScript, a superset of JavaScript. |
| vala | A programming language similar to csharp. |
| visualbasic | The Visual Basic language. |
| verilog | The System Verilog hardware description language |
| vhdl | Very High Speed Integrated Circuit Hardware description language. |
viml | vim,vimscript,ex | The language VimL is the scripting language for the Vim editor. |
| vuejs | Vue.js single-file components |
| wollok | Wollok lang |
| xml | The XML markup language. |
| realbasic | Xojo |
| yaml | The Yaml Ain’t Markup Language. A human friendly data serialization standard for all programming languages. |