Rouge - a pure Ruby syntax highlighter.

Overview

Rouge

Build Status Gem Version YARD Docs

Rouge is a pure Ruby syntax highlighter. It can highlight over 200 different languages, and output HTML or ANSI 256-color text. Its HTML output is compatible with stylesheets designed for Pygments.

Installation

In your Gemfile, add:

gem 'rouge'

or

gem install rouge

Usage

Rouge's most common uses are as a Ruby library, as part of Jekyll and as a command line tool.

Library

Here's a quick example of using Rouge as you would any other regular Ruby library:

require 'rouge'

# make some nice lexed html
source = File.read('/etc/bashrc')
formatter = Rouge::Formatters::HTML.new
lexer = Rouge::Lexers::Shell.new
formatter.format(lexer.lex(source))

# Get some CSS
Rouge::Themes::Base16.mode(:light).render(scope: '.highlight')
# Or use Theme#find with string input
Rouge::Theme.find('base16.light').render(scope: '.highlight')

Jekyll

Rouge is Jekyll's default syntax highlighter. Out of the box, Rouge will be used to highlight text wrapped in the {% highlight %} template tags. The {% highlight %} tag provides minimal options: you can specify the language to use and whether to enable line numbers or not. More information is available in the Jekyll docs.

Command Line

Rouge ships with a rougify command which allows you to easily highlight files in your terminal:

rougify foo.rb
rougify style monokai.sublime > syntax.css

Configuration

Formatters

Rouge comes with a number of formatters built-in but as of Rouge 2.0, you are encouraged to write your own formatter if you need something custom.

The built-in formatters are:

  • Rouge::Formatters::HTML.new will render your code with standard class names for tokens, with no div-wrapping or other bells or whistles.

  • Rouge::Formatters::HTMLInline.new(theme) will render your code with no class names, but instead inline the styling options into the style= attribute. This is good for emails and other systems where CSS support is minimal.

  • Rouge::Formatters::HTMLLinewise.new(formatter, class: 'line-%i') will split your code into lines, each contained in its own div. The class option will be used to add a class name to the div, given the line number.

  • Rouge::Formatters::HTMLLineHighlighter.new(formatter, highlight_lines: [3, 5]) will split your code into lines and wrap the lines specified by the highlight_lines option in a span with a class name specified by the highlight_line_class option (default: hll).

  • Rouge::Formatters::HTMLLineTable.new(formatter, opts={}) will output an HTML table containing numbered lines, each contained in its own table-row. Options are:

    • start_line: 1 - the number of the first row
    • line_id: 'line-%i' - a sprintf template for id attribute with current line number
    • line_class: 'lineno' - a CSS class for each table-row
    • table_class: 'rouge-line-table' - a CSS class for the table
    • gutter_class: 'rouge-gutter' - a CSS class for the line-number cell
    • code_class: 'rouge-code' - a CSS class for the code cell
  • Rouge::Formatters::HTMLPygments.new(formatter, css_class='codehilite') wraps the given formatter with div wrappers generally expected by stylesheets designed for Pygments.

  • Rouge::Formatters::HTMLTable.new(formatter, opts={}) will output an HTML table containing numbered lines similar to Rouge::Formatters::HTMLLineTable, except that the table from this formatter has just a single table-row. Therefore, while the table is more DOM-friendly for JavaScript scripting, long code lines will mess with the column alignment. Options are:

    • start_line: 1 - the number of the first line
    • line_format: '%i' - a sprintf template for the line number itself
    • table_class: 'rouge-table' - a CSS class for the table
    • gutter_class: 'rouge-gutter' - a CSS class for the gutter
    • code_class: 'rouge-code' - a CSS class for the code column
  • Rouge::Formatters::HTMLLegacy.new(opts={}) is a backwards-compatibility class intended for users of Rouge 1.x, with options that were supported then. Options are:

    • inline_theme: nil - use an HTMLInline formatter with the given theme
    • line_numbers: false - use an HTMLTable formatter
    • wrap: true - use an HTMLPygments wrapper
    • css_class: 'codehilite' - a CSS class to use for the Pygments wrapper
  • Rouge::Formatters::Terminal256.new(theme) is a formatter for generating highlighted text for use in the terminal. theme must be an instance of Rouge::Theme, or a Hash structure with :theme entry.

Writing your own HTML formatter

If the above formatters are not sufficient, and you wish to customize the layout of the HTML document, we suggest writing your own HTML formatter. This can be accomplished by subclassing Rouge::Formatters::HTML and overriding specific methods:

" tokens.each do |token, value| # for every token in the output, we render a span yield span(token, value) end yield "
" end # or, if you need linewise processing, try: def stream(tokens, &block) token_lines(tokens).each do |line_tokens| yield "
" line_tokens.each do |token, value| yield span(token, value) end yield "
" end end # Override this method to control how individual spans are rendered. # The value `safe_value` will already be HTML-escaped. def safe_span(token, safe_value) # in this case, "text" tokens don't get surrounded by a span if token == Token::Tokens::Text safe_value else "#{safe_value}" end end end">
class MyFormatter < Rouge::Formatters::HTML

  # this is the main entry method. override this to customize the behavior of
  # the HTML blob as a whole. it should receive an Enumerable of (token, value)
  # pairs and yield out fragments of the resulting html string. see the docs
  # for the methods available on Token.
  def stream(tokens, &block)
    yield "
   
" tokens.each do |token, value| # for every token in the output, we render a span yield span(token, value) end yield "
"
end # or, if you need linewise processing, try: def stream(tokens, &block) token_lines(tokens).each do |line_tokens| yield "
" line_tokens.each do |token, value| yield span(token, value) end yield "
"
end end # Override this method to control how individual spans are rendered. # The value `safe_value` will already be HTML-escaped. def safe_span(token, safe_value) # in this case, "text" tokens don't get surrounded by a span if token == Token::Tokens::Text safe_value else "\"#{token.shortname}\">#{safe_value}" end end end

Lexer Options

  • debug: false will print a trace of the lex on stdout.

  • parent: '' allows you to specify which language the template is inside.

CSS Options

  • scope: '.highlight' sets the CSS selector to which styles are applied, e.g.:

    Rouge::Themes::MonokaiSublime.render(scope: 'code')

Documentation

Rouge's documentation is available at rouge-ruby.github.io/docs/.

Requirements

Ruby

Rouge is compatible with all versions of Ruby from 2.0.0 onwards. It has no external dependencies.

Encodings

Rouge only supports UTF-8 strings. If you'd like to highlight a string with a different encoding, please convert it to UTF-8 first.

Integrations

Contributing

We're always excited to welcome new contributors to Rouge. By it's nature, a syntax highlighter relies for its success on submissions from users of the languages being highlighted. You can help Rouge by filing bug reports or developing new lexers.

Bug Reports

Rouge uses GitHub's Issues to report bugs. You can choose from one of our templates or create a custom issue. Issues that have not been active for a year are automatically closed by GitHub's Probot.

Developing Lexers

NOTE: Please don't submit lexers that are copy-pasted from other files. These submission will be rejected and we don't want you to waste your time.

We want to make it as easy as we can for anyone to contribute a lexer to Rouge. To help get you started, we have a shiny new guide on lexer development in the documentation. The best place is to start there.

If you get stuck and need help, submit a pull request with what you have and make it clear in your submission that the lexer isn't finished yet. We'll do our best to answer any questions you have and sometimes the best way to do that is with actual code.

Testing Rouge

Once you've cloned the repository from GitHub, you can test the core of Rouge simply by running rake (no bundle exec required). You can also run a single test file by setting the TEST environment variable to the path of the desired test. For example, to test just the ruby lexer (located at path spec/lexers/ruby_spec.rb) simply run the following:

TEST=spec/lexers/ruby_spec.rb rake

To test a lexer visually, run rackup from the top-level working directory and you should have a web server running and ready to go. Visit http://localhost:9292 to see the full list of Rouge's lexers.

Once you've selected a particular lexer, you can add ?debug=1 to your URL string to see a lot of helpful debugging info printed on stdout.

Versioning

Rouge uses Semantic Versioning 2.0.0.

Maintainers

Rouge is largely the result of the hard work of unpaid volunteers. It was originally developed by Jeanine Adkisson (@jneen) and is currently maintained by Jeanine Adkisson, Drew Blessing (@dblessing) and Goro Fuji (@gfx).

License

Rouge is released under the MIT license. Please see the LICENSE file for more information.

Comments
  • Add SuperCollider language support

    Add SuperCollider language support

    This adds support for the SuperCollider language.

    The visual sample contains a near-complete rundown of general language cases, including corner cases that I've found as a maintainer of the language's own backend lexer. The highlighting is mostly adapted from the project's IDE's lexing regexes, which I've found to be the most solid set among all the lexers out there for the language.

    Let me know if I missed anything. Thanks!

    opened by mossheim 38
  • Lazily load lexers using `LangSpec`

    Lazily load lexers using `LangSpec`

    • A rake task (generate:cache) loads all the files in lib/rouge/lexers/*.rb and creates lib/rouge/langspec_cache.rb. This adds a bunch of LangSpec objects into Rouge::Lexer.registry and Rouge::Lexer.lazy_constants (indexed by tag/aliases and constant names respectively)
    • When you require 'rouge' normally, we load this cache file instead of all the lexers. A LangSpec object has enough information on it to act like the lexer class itself, and will eagerly load the class when you call .new(...), .lex(...), or .continue_lex(...)
    • When it does so, it replaces itself with the actual lexer class in the registry, and is therefore GC-able.
    • We will also eagerly load the lexer if const_missing is hit in the Rouge::Lexers namespace.
    • In the case that a user is confident they will use all of the lexers anyways, we provide a method Rouge::Lexers.preload! which will eagerly load all of the lexers. You can test the memory performance of this case, which is slightly worse than master, by running rake check:memory[preload].

    TODO BEFORE MERGE:

    • [x] Figure out when to automatically run rake generate:cache
    • [x] Think about thread safety (Lexer.find(x).new(y) will be called in multiple threads in most servers, we may need to protect with a mutex)
    • [x] Test whether this actually saves memory on load and whether it increases the burden afterwards.

    Closes #1135

    author-action 
    opened by jneen 34
  • Performance improvements

    Performance improvements

    Hey, I'm playing around with Rouge right now. It's awesome to have a really good port of Pygments in Ruby.

    The only thing it misses right now is comparable speed. In my tests (Ruby 1.9.3 and Python 2.7.2), rougify is about 4-7x slower than pygmentize.

    To help things, I detected two hot spots that are easy to optimize. It should speed up highlighting by about 40%:

    1.9.3-p194 ~/ruby/rouge:master time ruby -Ilib bin/rougify highlight code.json > /dev/null
    real    0m3.437s
    
    1.9.3-p194 ~/ruby/rouge:speedup time ruby -Ilib bin/rougify highlight code.json > /dev/null
    real    0m2.077s
    
    1.9.3-p194 ~/ruby/rouge:master time ruby -Ilib bin/rougify highlight code.rb > /dev/null
    real    0m12.583s
    
    1.9.3-p194 ~/ruby/rouge:speedup time ruby -Ilib bin/rougify highlight code.rb > /dev/null
    real    0m6.885s
    
    • code.rb is the Rouge code (348K)
    • code.json is a simple JSON log file (216K)

    Maybe we can find more such optimizations. Based on my own experience, I firmly believe that Ruby code can be as fast as Python code without sacrificing too much beauty.

    opened by korny 30
  • "language-plaintext"">

    "highlight plaintext" -> "language-plaintext"

    I read this recently which proposes:

    [...] so that syntax highlighting scripts can use the right rules, may do so by adding a class prefixed with "language-" to the element.

    I'm thinking about adding this to middleman-syntax, by checking whether :css_class ends with a dash, if so then it would be concatenated to the lexer.tag instead of being joined by a space.

    Also, middleman-syntax interpolates the chosen :css_class instead of just using highlight. Is this possible within Rouge itself?

    Just checking If Rouge can do these things by itself, if not then middleman-syntax can easily handle this anyway.

    TL;DR: In rouge/plugins/redcarpet use the actual :css_class instead of the hard-coded highlight class and concatenate them if the :css_class ends with a dash. Also possibly change the default class from highlight to language-.

    Sidenote: Is this code really necessary? Wondering if I need to bring that hack into middleman-syntax or not.

    opened by Arcovion 27
  • Lazy-load lexers

    Lazy-load lexers

    As of Rouge-3.3.0, all lexers are loaded into memory via require 'rouge'. Now that more and more lexers with numerous rules are being introduced, Rouge is going to bloat the memory unnecessarily. The chances of a consumer using a major percentage of the bundled lexers are very low.

    Therefore, I would like to propose to have the lexers be loaded into memory as necessary similar to how Ruby's Module#autoload functions.

    Whatsay @pyrmont, @dblessing, @gfx, @jneen?

    enhancement-request stale-issue 
    opened by ashmaroli 25
  • Cleaning up pull requests - Reviewed minor fixes and enhancements

    Cleaning up pull requests - Reviewed minor fixes and enhancements

    @dblessing - as per e-mail here is a list of pull requests for bug fixes and enhancements I have reviewed that I consider fit to merge as is. As for #1063: I'm happy to create a single pull-request with squashed commits, one for each of these pull requests if you're ok with this list and if it'll help get them merged. As for #1063, sorting #1062 is a pre-requisite so we have CI working again.

    Bug fixes

    • ~~#1031 Fix XML not being detected as XML because the file contains <html somewhere~~
    • ~~#1048 Implement Matlab2017a strings; fix #1047~~
    • ~~#1026 Restore support for highlighting XML-encoded plists~~
    • #893 sed: Fix issue #860 - handling sed format may hide some text.
    • #857 Q: Allow comments with multiple leading whitespace

    Enhancements

    • #1060 Recognize hs-boot files as Haskell
    • #975 Add highlighting for Pipfile
    • ~~#1040 Update Scala lexer with more differentiated tokens~~
    • ~~#1055 Kotlin Suspend keyword~~
    • #976 Add highlighting for Fastlane files
    • ~~#1061 Add missing CoffeeScript keywords and reserved words~~
    • ~~#1034 Add missing tokens from Pygments 2.2.0~~
    • #1027 Haskell: Properly highlight promoted data constructors
    • #991 m68k lexer update
    • #984 Rust: Fix integer literals' delimiter
    • #973 Add missing keywords for PHP
    • #972 Enable libsonnet suffix in jsonnet language
    • #952 Gherkin: Correctly highlight placeholders
    • #897 Add HTMLLineAnchors formatter
    • #894 Console lexer: Use whitespace after prompt
    • #875 Javascript: Handle ES6 regex flags
    • #850 Show error when developing lexer if highlighted section is different to the raw section
    • #848 Lisp: Add "lisp" alias to common-lisp lexer
    • #830 Fix Prolog comment character
    • #822 PHP: Support Drupal 8 filename extension
    • #806 Swift: Improve attribute formatting
    • #804 Add Ayu Light theme

    My own fixes

    I consider these ok, but I'm the only one who has reviewed them:

    • ~~#1068 Fix #1022 (diff syntax highlighting for non-unified diffs) and close #846 by adding highlighting of diff headers.~~
    • ~~#1069 Fixes #1009, fixes #879 issues w/C and C++ highlighting~~

    EDIT: Added #1068 EDIT2: Added #1069

    stale-issue discussion-open 
    opened by vidarh 25
  • Implement a basic lexer for elm

    Implement a basic lexer for elm

    References issue #472

    Hi, I had a go at implementing a basic Lexer.

    I couldn't really understand the other Lexers so I decided to create one as simple as possible.

    I tested the output manually via ./bin/rougify and used those files as a reference: https://github.com/evancz/elm-architecture-tutorial/tree/master/examples.

    I had to use a couple of ugly hacks in order to implement Name::Builtin, so this code is not quite ready but I'd love some feedback before diving in further.

    opened by benjamin-thomas 25
  • Add support for Solidity

    Add support for Solidity

    Adding support for Solidity into master.

    Previously discussed here: https://github.com/jneen/rouge/pull/760

    I needed to open a new issue for Gitcoin. Our current version (basic functionality but outdated): https://github.com/ritzdorf/rouge/blob/485940397eb023fc23abe32ec4dba0582d368d1f/lib/rouge/lexers/solidity.rb

    lexer-request 
    opened by ritzdorf 24
  • Backslash handling for PowerShell scripts is incorrect

    Backslash handling for PowerShell scripts is incorrect

    The PowerShell lexer inherits a chunk of behaviour from the shell-script lexer. Since backslashes ("\") are not escape characters in PowerShell, this results in some odd syntax-highlights when Windows-style paths are used: rouge_backslash_old

    I have taken a quick look to see if I can modify the powershell.rb to remove the special handling of backslash, but I can't figure out how to just "turn off" the rules without re-creating all of the affected states.

    opened by gmckeown 24
  • Avoid object instantiation in lexers

    Avoid object instantiation in lexers

    One way to reduce the memory usage of Rouge is to avoid instantiation of objects in individual lexers. Based on the report generated by rake profile_memory, it would seem the biggest causes of unnecessary object instantiation in a lexer are:

    1. a failure to wrap arrays of keywords in class methods so that you do this:

      keywords = ['if', 'elsif', 'else']
      

      rather than this:

      def self.keywords
        @keywords ||= ['if', 'elsif', 'else']
      end
      
    2. a failure to wrap regexs (especially involving interpolation) in class methods so that you do this:

      reserved = /(\b#{keywords.join('|')}\b)/
      

      rather than this:

      def self.reserved
        @reserved ||= /(\b#{keywords.join('|')}\b)/
      end
      

    Initial testing suggested this can lead to a substantial reduction in memory used by the lexers. The AppleScript lexer (the largest lexer by memory usage) can be reduced from 65KB to 2.22KB by simply putting the regular expressions defined as local variables behind class methods.

    Do you have any interest in doing this thankless task, @ashmaroli? (I promise I will thank you!)

    enhancement-request stale-issue 
    opened by pyrmont 23
  • Add Support for React JSX

    Add Support for React JSX

    The JavaScript framework "React" by Facebook does introduce a syntax extension for JavaScript. It adds something which looks like XML in JavaScript.

    As React is getting a lot of attention in the JavaScript frontend framework world (e.g. 23000+ stars on github), it would be great to have support for JSX highlighting with rouge.

    React Framework: https://github.com/facebook/react JSX Specs: https://facebook.github.io/jsx/

    File extensions: .js, .jsx

    opened by jthomaschewski 21
  • Use File.basename instead sub to correctly handle long paths on Windows

    Use File.basename instead sub to correctly handle long paths on Windows

    Problem

    Recently I faced a crash on windows:

    C:/Users/RUNNER~1/AppData/Local/Temp/ocr219E.tmp/lib/ruby/gems/2.7.0/gems/rouge-4.0.1/lib/rouge/lexer.rb:532:in `load': cannot load such file -- C:/Users/RUNNER~1/AppData/Local/Temp/ocr219E.tmp/lib/ruby/gems/2.7.0/gems/rouge-4.0.1/lib/rouge/lexers/C:/Users/runneradmin/AppData/Local/Temp/ocr219E.tmp/lib/ruby/gems/2.7.0/gems/rouge-4.0.1/lib/rouge/lexers/abap.rb (LoadError)
    	from C:/Users/RUNNER~1/AppData/Local/Temp/ocr219E.tmp/lib/ruby/gems/2.7.0/gems/rouge-4.0.1/lib/rouge/lexer.rb:532:in `load_lexer'
    	from C:/Users/RUNNER~1/AppData/Local/Temp/ocr219E.tmp/lib/ruby/gems/2.7.0/gems/rouge-4.0.1/lib/rouge.rb:54:in `block in load_lexers'
    	from C:/Users/RUNNER~1/AppData/Local/Temp/ocr219E.tmp/lib/ruby/gems/2.7.0/gems/rouge-4.0.1/lib/rouge.rb:53:in `each'
    	from C:/Users/RUNNER~1/AppData/Local/Temp/ocr219E.tmp/lib/ruby/gems/2.7.0/gems/rouge-4.0.1/lib/rouge.rb:53:in `load_lexers'
    	from C:/Users/RUNNER~1/AppData/Local/Temp/ocr219E.tmp/lib/ruby/gems/2.7.0/gems/rouge-4.0.1/lib/rouge.rb:69:in `<top (required)>'
    

    It looks like __dir__ may return a short username (or path) RUNNER~1 instead runneradmin as result this prefix not "stripped"

    Proposed solution

    There is more reliable way to get filename instead f.sub(...) i.e. use File.basename

    opened by CAMOBAP 0
  • Updating rouge on Github Pages

    Updating rouge on Github Pages

    Github Pages is still using Rouge version 3.2.6. I posted a Github issue in February asking if they can update to a more recent version, but the last several updates this year still use 3.2.6. Does anyone have suggestions for how to nudge them to incorporate the latest version?

    opened by reifjulian 1
  • Github Dark style

    Github Dark style

    I was trying to use primer/css with markdown and when combined with rouge the code sections work as one would expect in light mode. But when using primer's dark mode (any of them) rouge's highlighting is a little off. Is there any chance you would consider adding a github.dark style?

    Thanks!

    enhancement-request 
    opened by dunkmann00 0
  • Lexer request: udev rules

    Lexer request: udev rules

    Please note: New lexers are contributed to Rouge from the community. Your request will help the community in developing a lexer but it does not mean that anyone will develop the lexer.

    The name of the language udev rules https://man.archlinux.org/man/udev.7

    Implementation in other libraries https://github.com/dpkristensen/udev-rules https://www.vim.org/scripts/script.php?script_id=1381

    Additional context Add any other context about the lexer request here.

    lexer-request 
    opened by UlyssesZh 0
  • Non-ascii characters in names are marked as error in Crystal and Ruby

    Non-ascii characters in names are marked as error in Crystal and Ruby

    Any non-ascii characters appear as error with red background. Crystal and Ruby handle unicode names fine. Code below compiles and runs fine in both languages.

    Name of the lexer

    • Crystal
    • Ruby

    Code sample

    class SzélütöttŰrújságírónő
      def self.szélütött_űrújságírónő
        "szélütött űrújságírónő"
      end
    end
    
    puts SzélütöttŰrújságírónő.szélütött_űrújságírónő
    

    See on rouge.jneen.net

    bugfix-request 
    opened by kolesar-andras 0
Releases(v4.0.1)
  • v4.0.1(Dec 17, 2022)

    This release introduces a number of updates and fixes across Coq, Gherkin, HTTP, Java, JavaScript, LLVM, Powershell, Praat, SystemD, Vala and YAML lexer.

    Thanks to all the contributors who help make Rouge better. On behalf of the Rouge maintainers, we wish you a season full of joy and magic and a bright New Year.

    Full Changelog: https://github.com/rouge-ruby/rouge/compare/v4.0.0...v4.0.1

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0(Sep 7, 2022)

    This is a major release and includes some breaking changes:

    • Drop support for Ruby < 2.7 (https://github.com/rouge-ruby/rouge/pull/1862)
    • Remove support for Solidity Lexer (045d7bc)

    As part of this release, we added one new RML lexer and also made some bug fixes and improvements across HTTP, TSX, TOML, Haxe, Praat, Make and Diff lexer.

    Thank you to all of the amazing contributors for your help and continuous support!

    Full Changelog: https://github.com/rouge-ruby/rouge/compare/v3.30.0...v4.0.0

    Source code(tar.gz)
    Source code(zip)
  • v3.30.0(Jul 30, 2022)

    We bring you 3 new exciting lexers in this release: Isabelle, Meson and Nial lexer. There are also some fixes and improvements on CPP, Dart, Groovy, JavaScript, Pascal, PHP and TOML lexer.

    Thank you to all of the amazing contributors for your help and continuous support!

    Full Changelog: https://github.com/rouge-ruby/rouge/compare/v3.29.0...v3.30.0

    Source code(tar.gz)
    Source code(zip)
  • v3.29.0(Jun 1, 2022)

    We bring you 5 new exciting lexers in this release: Idris, Lean, Syzlang and Syzprog lexer. There are also some fixes and improvements on Docker, Matlab and Python lexer.

    Furthermore, we have made some improvements in Rouge and Rouge CI. We are now running Ruby 3.1 as part of our CI. As part of this release, we also introduced Code of Conduct v2.1.

    Thank you to all of the amazing contributors for your help and continuous support!

    Full Changelog: https://github.com/rouge-ruby/rouge/compare/v3.28.0...v3.29.0

    Source code(tar.gz)
    Source code(zip)
  • v3.28.0(Jan 26, 2022)

    This first release of 2022 introduces 3 new lexers: Fluent, Stan and Stata. There are also numerous fixes and improvements across C, Console, CPP, Cypher, Dart, HCL, JSX, Kotlin, Rust, SPARQL and TOML lexer. In addition, we have added support to run the visual test app in Ruby 3.0.

    Thank you to everyone who has contributed to this release. It is wonderful to see some first-time contributors. May all your wishes come true in 2022!

    Source code(tar.gz)
    Source code(zip)
  • v3.27.0(Dec 17, 2021)

    This release brings you a brand new lexer, Dafny and a number of improvements on Ceylon, Elixir, Rust, SQL and Swift lexer.

    We have also documented Rouge supported languages (see languages.md in the docs folder). Additionally, we have migrated Rouge CI from Travis to GitHub workflows. See the CHANGELOG for the detailed list of changes.

    Thank you to all our wonderful contributors and your continuous support. We wish you all a joyjous festive season. Stay safe and keep on lexing!

    Source code(tar.gz)
    Source code(zip)
  • v3.26.1(Sep 22, 2021)

    This release includes some notable changes:

    • Fix the catastrophic backtracking presented in Factor and GHC Core Lexer
    • Fix Ruby 2.7 keyword parameter deprecation warning

    There are also fixes for CPP, JSL and YAML lexer.

    Thank you to all the wonderful contributors who help to make Rouge better. Happy highlighting!

    Source code(tar.gz)
    Source code(zip)
  • v3.26.0(Dec 8, 2020)

    There are two things to report in this release.

    The first are the usual notes. We have two new lexers: one for OCL and one for ReScript. There are also fixes for the CMake, Crystal, JSL, Python, ReasonML and Rust lexers. Thank you to all the contributors!

    The second is that I'd like to announce that this will be my last release as a maintainer of Rouge. It's been a terrific experience and I'd like to thank @jneen and the other maintainers for making me feel very welcome. I wish them all the best as Rouge moves to version 4!

    Source code(tar.gz)
    Source code(zip)
  • v3.25.0(Nov 10, 2020)

    No new lexers this time but we do have a lot of updates. There are fixes for the Batchfile, C++, Docker, JavaScript, Kotlin, Perl, PowerShell, Ruby, Rust and Velocity lexers. Enjoy!

    Source code(tar.gz)
    Source code(zip)
  • v3.24.0(Oct 13, 2020)

    This release has two new lexers: one for e-mails (yes, I am aware it is only me that spells it that way) and one for J (why not another language starting with J?). There's also fixes for the Apex, HTTP, Janet, JavaScript and Rust lexers. And on top of all of that, there are some improvements to Rouge itself, including a new CLI debug command and a line highlighting option.

    Thanks to everyone who contributed bug reports and pull requests. Stay safe and lex responsibly!

    Source code(tar.gz)
    Source code(zip)
  • v3.23.0(Sep 8, 2020)

    This release has two new lexers: one for PostScript and one for systemd unit files. There's also fixes for the Kotlin, Ruby and Rust lexers. Thanks to all the contributors who help make Rouge better. Don't forget to wear a mask!

    Source code(tar.gz)
    Source code(zip)
  • v3.22.0(Aug 11, 2020)

    This is a small release with just one update: a major rewrite of the PHP lexer. Hopefully the improved level of detail makes your PHP code look prettier but do report any issues you find with it!

    Source code(tar.gz)
    Source code(zip)
  • v3.21.0(Jul 14, 2020)

    This release has three new lexers, one for BrightScript, one for Janet and one for SSH Config. There's also fixes for the Batchfile, C++, Jinja, Perl, PowerShell, Rego, Sass, SCSS and Twig lexers. Happy highlighting!

    Source code(tar.gz)
    Source code(zip)
  • v3.20.0(Jun 9, 2020)

    We've got some new lexers again! This release includes lexers for Augeas, BibTeX, HLSL, LiveScript, Velocity and Zig. On top of that, we have fixes for the C++, Diff, Haskell, HTML, JavaScript, JSX, OpenType Feature File, PowerShell, TSX and TypeScript lexers.

    I'd like to especially call out @lkinasiewicz for the LiveScript lexer. This was originally submitted back in 2017 and it's great to have it finally part of Rouge! The backlog of outstanding PRs is still too long but we are slowly making progress. As I like to say: forward, not backward; upward, not forward; and always twirling, twirling, twirling towards freedom!

    Source code(tar.gz)
    Source code(zip)
  • v3.19.0(May 12, 2020)

    No new lexers this but release but we do have fixes for the JavaScript, Kotlin, Python, SPARQL and Turtle lexers. In addition, there have been some under the hood improvements to how keywords are generated for certain languages.

    Stay safe everyone!

    Source code(tar.gz)
    Source code(zip)
  • v3.18.0(Apr 14, 2020)

    This release includes new lexers for Cypher, Datastudio, GHC Cmm, ISBL, Rego, Solidity and YANG. It also incorporates fixes for the C++, CMake, Console, F#, JSON, JSONDOC, Kotlin, Markdown, Pascal, PHP, Python, Racket, Ruby, Terraform, TypeScript and Vue lexers. Which seems like quite a lot. Enjoy!

    Source code(tar.gz)
    Source code(zip)
  • v3.17.0(Mar 10, 2020)

    This release includes the ECL lexer as a new lexer. It also incorporates fixes for the CoffeeScript, Markdown, NASM, Ruby, Scala and Varnish lexers. Enjoy your syntax highlighting! 🎉

    Source code(tar.gz)
    Source code(zip)
  • v3.16.0(Feb 11, 2020)

    This release includes one new lexer: the Varnish lexer! We also have fixes for the D, Java, Lua, NASM, Objective-C, PowerShell, Rust, Shell, TOML and TypeScript lexers.

    Thank you to all the contributors who've helped make Rouge better!

    Source code(tar.gz)
    Source code(zip)
  • v3.15.0(Jan 14, 2020)

    This release includes three new lexers: FreeFEM, GHC and Objective-C++. Thanks to contributions from the community, we also have fixes for the Console, Jinja, LLVM, Python, Rust and Swift lexers. Finally, you should now be able to pass 'false' as an option after a fix to how CGI-style options are parsed.

    Happy new year to everyone! We look forward to another year of Rouge 😃

    Source code(tar.gz)
    Source code(zip)
  • v3.14.0(Dec 10, 2019)

    This release includes fixes for the JSONDOC, Liquid, Magik and TOML lexers as well as the addition of the NES Assembly and Slice lexers.

    If all goes according to plan, this will be the last release for 2019. Thanks to all the contributors who improved Rouge—this library wouldn't be what it is without you. See you all again in the new year!

    Source code(tar.gz)
    Source code(zip)
  • v3.13.0(Nov 12, 2019)

    This release includes a fix for the BPF lexer and the Q lexer and the addition of the TTCN-3 lexer. We've also slowed down the cadence for releases. Releases are now scheduled to come out on the second Tuesday of each month.

    Source code(tar.gz)
    Source code(zip)
  • v3.12.0(Oct 15, 2019)

    This release includes a handful of fixes (one for the Embedded Elixir lexer and a couple for Rouge itself) and the addition of the Minizinc lexer.

    Source code(tar.gz)
    Source code(zip)
  • v3.11.1(Oct 1, 2019)

    This is a small update that provides a fix for the Perl lexer.

    As is evident from the last couple of releases, we've slowed down the pace of development over the past couple of weeks. There are still a lot of pull requests to clear but it's likely that this will happen at a slower rate than has been the case. Thanks for your patience!

    Source code(tar.gz)
    Source code(zip)
  • v3.11.0(Sep 17, 2019)

    This release includes some fixes for existing lexers and support for three new languages.

    I'd also like to call out the updates to the Liquid lexer. Although this was submitted via a single PR, it represents a substantial amount of work and is a large upgrade to the previous version of the lexer. Special thanks to @EricFromCanada 🎉

    Source code(tar.gz)
    Source code(zip)
  • v3.10.0(Sep 3, 2019)

  • v3.9.0(Aug 20, 2019)

    This release includes fixes for a number of lexers and support for three new languages.

    This is a lighter release in comparison to the past couple of versions. We've taken a bit of a summer break and perhaps been slightly distracted by the latest update to No Man's Sky.

    Source code(tar.gz)
    Source code(zip)
  • v3.8.0(Aug 6, 2019)

  • v3.7.0(Jul 23, 2019)

  • v3.6.0(Jul 9, 2019)

    This release includes continued improvements to the library, fixes for a number of lexers and—like v3.5.0—support for three new languages.

    Source code(tar.gz)
    Source code(zip)
  • v3.5.1(Jun 25, 2019)

Owner
rouge-ruby
syntax highlighting for ruby
rouge-ruby
A funny project to help you test your BNF syntax

Readme The idea of this project is to implement a BNF expression compiler. We could use BNF to design some syntax like Arithmetic expression. <factor>

Jack Chen 4 Dec 21, 2022
Kotlin-koans - Kotlin Koans are a series of exercises to get you familiar with the Kotlin Syntax

kotlin-koans-edu Kotlin Koans are a series of exercises to get you familiar with

null 1 Jan 11, 2022
A simple and opinionated AES encrypt / decrypt Ruby gem that just works.

AESCrypt - Simple AES encryption / decryption for Ruby AESCrypt is a simple to use, opinionated AES encryption / decryption Ruby gem that just works.

Gurpartap Singh 158 Oct 18, 2022
Simple API to perform AES encryption on Android. This is the Android counterpart to the AESCrypt library Ruby and Obj-C (with the same weak security defaults :( ) created by Gurpartap Singh. https://github.com/Gurpartap/aescrypt

AESCrypt-Android Simple API to perform AES encryption on Android with no dependancies. This is the Android counterpart to the AESCrypt library Ruby an

Scott Alexander-Bown 636 Dec 18, 2022
Simple and extendable code highlighter in Kotlin Multiplatform

Kighlighter Simple and extendable code highlighter in Kotlin Multiplatform with a composable output to display the code highlighted on Android and Des

Gérard Paligot 21 Dec 2, 2022
Display code with syntax highlighting :sparkles: in native way.

CodeView (Android) CodeView helps to show code content with syntax highlighting in native way. Description CodeView contains 3 core parts to implement

Kirill Biakov 827 Dec 22, 2022
Display code with syntax highlighting :sparkles: in native way.

CodeView (Android) CodeView helps to show code content with syntax highlighting in native way. Description CodeView contains 3 core parts to implement

Kirill Biakov 827 Dec 22, 2022
KodeEditor - A simple code editor with syntax highlighting and pinch to zoom

KodeEditor - A simple code editor with syntax highlighting and pinch to zoom

Markus Ressel 65 Oct 28, 2022
Scala 3 Standard Library with bracket syntax.

Scala 3 Library with braces Scala adds a terrible new feature, optional braces, which allow use indentation instead of braces. The new syntax is widel

Glavo 10 Dec 30, 2021
Modern JSON processor with readable Kotlin syntax.

Kq Modern cross-platform JSON processor with readable Kotlin syntax. cat ~/Desktop/bdb.ndjson | kq '.filter{it.bool("muted")}.sortedBy{it.long("size")

Daniel Demidko 6 Jan 25, 2022
A funny project to help you test your BNF syntax

Readme The idea of this project is to implement a BNF expression compiler. We could use BNF to design some syntax like Arithmetic expression. <factor>

Jack Chen 4 Dec 21, 2022
Kotlin-koans - Kotlin Koans are a series of exercises to get you familiar with the Kotlin Syntax

kotlin-koans-edu Kotlin Koans are a series of exercises to get you familiar with

null 1 Jan 11, 2022
Kotlin-basic-calculator - Basic calculator to understand syntax and the methods of Kotlin

KotlinBasicCalculator I always love to create a calculater for understand the sy

Onur Serbes 1 Mar 8, 2022
Theme for VSCode and JetBrains IDEs, based on morhetz/gruvbox but with a plainer color palette for syntax highlighting.

gruvbox-plain Theme for VSCode and JetBrains IDEs, based on morhetz/gruvbox but with a plainer color palette for syntax highlighting. Syntax Colors gr

null 2 Dec 28, 2022
:sound: [Android Library] Easily generate pure audio tone of any frequency in android

Android library to easily generate audio tone in android. Generating pure tone of an specific frequency was never that easy. ZenTone does all the heav

Nishant Srivastava 102 Dec 19, 2022
Pure Java code generation tool for generating a fully functional ContentProvider for Android.

RoboCoP RoboCoP is a Java library that can generate a fully-functional ContentProvider from a simple JSON schema file. Get the latest version from our

Rain 246 Dec 29, 2022
Nuwa, pure java implementation, can hotfix your android application.

Nuwa Nuwa is a goddess in ancient Chinese mythology best known for repairing the pillar of heaven. With this Nuwa project,you can also have the repair

Jason Ross 3k Dec 17, 2022
Template (pure) for KMM application with DI support

KMM di template Template (pure) for KMM application with DI support. Uses Multiplatform-DI for Dependency Injection Features Common architecture (VIP)

Anna Zharkova 8 Oct 18, 2022
A pure-Kotlin library for bots to interface with Revolt

RevoltKt A pure-Kotlin library for bots to interface with Revolt Sample Usage import me.maya.revolt.defaultClientBuilder import me.maya.revolt.events.

Maya 8 May 20, 2022
Lightweight service for creating standalone mock, written in pure Kotlin with Netty container.

MockService The lightweight service for creating a standalone mock, written in pure Kotlin with Netty container. The service allows getting config fil

null 2 Oct 28, 2021