Module: Kramdown::Converter::SyntaxHighlighter::Rouge

### Home Classes Methods

### In Files

- lib/kramdown/converter/syntax_highlighter/rouge.rb

### Methods

- ::call

### Class/Module Index

Quicksearch

- Kramdown
- Kramdown::Converter
- Kramdown::Converter::Base
- Kramdown::Converter::Html
- Kramdown::Converter::Kramdown
- Kramdown::Converter::Latex
- Kramdown::Converter::MathEngine
- Kramdown::Converter::MathEngine::Itex2MML
- Kramdown::Converter::MathEngine::Mathjax
- Kramdown::Converter::MathEngine::MathjaxNode
- Kramdown::Converter::MathEngine::Ritex
- Kramdown::Converter::RemoveHtmlTags
- Kramdown::Converter::SyntaxHighlighter
- Kramdown::Converter::SyntaxHighlighter::Coderay
- Kramdown::Converter::SyntaxHighlighter::Minted
- Kramdown::Converter::SyntaxHighlighter::Rouge
- Kramdown::Converter::Toc
- Kramdown::Document
- Kramdown::Element
- Kramdown::Error
- Kramdown::Options
- Kramdown::Options::Boolean
- Kramdown::Parser
- Kramdown::Parser::Base
- Kramdown::Parser::GFM
- Kramdown::Parser::Html
- Kramdown::Parser::Html::Constants
- Kramdown::Parser::Html::ElementConverter
- Kramdown::Parser::Html::Parser
- Kramdown::Parser::Kramdown
- Kramdown::Parser::Markdown
- Kramdown::Utils
- Kramdown::Utils::Configurable
- Kramdown::Utils::Entities
- Kramdown::Utils::Entities::Entity
- Kramdown::Utils::Html
- Kramdown::Utils::OrderedHash
- Kramdown::Utils::StringScanner
- Kramdown::Utils::Unidecoder

No matching classes.

# Kramdown::Converter::SyntaxHighlighter::Rouge

Uses Rouge which is CSS-compatible to Pygments to highlight code blocks and code spans.

### Constants

AVAILABLE

  Highlighting via Rouge is available if this constant is `true`.

### Public Class Methods

call(converter, text, lang, type, _unused_opts) click to toggle source

    # File lib/kramdown/converter/syntax_highlighter/rouge.rb, line 23
    def self.call(converter, text, lang, type, _unused_opts)
      opts = converter.options[:syntax_highlighter_opts].dup
      lexer = ::Rouge::Lexer.find_fancy(lang || opts[:default_lang], text)
      return nil unless lexer

      opts[:wrap] = false if type == :span

      formatter = (opts.delete(:formatter) || ::Rouge::Formatters::HTML).new(opts)
      formatter.format(lexer.lex(text))
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.