Module: Kramdown::Converter::SyntaxHighlighter

### Home Classes Methods

### In Files

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

### Namespace

- MODULE Kramdown::Converter::SyntaxHighlighter::Coderay
- MODULE Kramdown::Converter::SyntaxHighlighter::Minted
- MODULE Kramdown::Converter::SyntaxHighlighter::Rouge

### 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

## Container for Syntax Highlighters

This module serves as container for the syntax highlighters that can be used together with kramdown.

A syntax highlighter should not store any data itself but should use the provided converter object to do so (See Kramdown::Converter::Base#data).

## Implementing a Syntax Highlighter

Implementing a new syntax highlighter is easy because it is just an object that needs to respond to call.

The method call needs to take the following arguments:

converter | This argument contains the converter object that calls the syntax highlighter. It can be used, for example, to store data in Kramdown::Converter::Base#data for one conversion run.
text | The raw text that should be highlighted.
lang | The language that the text should be highlighted for (e.g. ruby, python, ...).
type | The type of text, either :span for span-level code or :block for a codeblock.
opts | A Hash with options that may be passed from the converter.

The return value of the method should be the highlighted text, suitable for the given converter (e.g. HTML for the HTML converter).

## Special Implementation Details

HTML converter | If the syntax highlighter is used with a HTML converter, it should return :block type text correctly wrapped (i.e. normally inside a pre-tag, but may also be a table-tag or just a div-tag) but :span type text without a code-tag!

[Validate]

Generated with the Darkfish Rdoc Generator 2.