Skip to content

Rouge support will not accept custom formatter #214

Closed
@IanTrudel

Description

@IanTrudel

Syntax highlighting using Rouge has ::Rouge::Formatters::HTML.new(opts) formatter embedded into the code, not allowing the use of a custom formatter. It would be great to be able to pass a custom formatter as an option to the syntax highlighter.

CASE STUDY
I am using custom classes for Kramdown and Rouge to allow rendering in http://shoesrb.com/ to replace the old manual. Those classes generate methods that Shoes can interpret to create GUI elements according to the markdown.

For example, *This is in bold.* is transformed into para(strong("This is in bold.")). Rouge may determine it is a literal string and return, say, a color of value #336633, which would in turn be translated into para(strong("This is in bold."), :stroke => "#336633").

The current solution involves copying the code from Kramdown::Converter::SyntaxHighlighter::Rouge.call and replace the formatter with my custom formatter.

REFERENCE
https://github.com/gettalong/kramdown/blob/master/lib/kramdown/converter/syntax_highlighter/rouge.rb#L31

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions