Commit aa2c437f authored by Munken's avatar Munken

Hacked in Math Lexer

parent 525c2a78
require 'rouge/plugins/redcarpet' require 'rouge/plugins/redcarpet'
module Rouge
module Lexers
class Math < Lexer
title "Plain Text"
desc "A boring lexer that doesn't highlight anything"
tag 'math'
aliases 'text'
filenames '*.txt'
mimetypes 'text/plain'
default_options :token => 'Text'
def token
@token ||= Token[option :token]
end
def stream_tokens(string, &b)
yield self.token, string
end
end
end
end
module Banzai module Banzai
module Filter module Filter
# HTML Filter to highlight fenced code blocks # HTML Filter to highlight fenced code blocks
...@@ -48,6 +72,9 @@ module Banzai ...@@ -48,6 +72,9 @@ module Banzai
end end
def lexer_for(language) def lexer_for(language)
if language == 'math'
return Rouge::Lexers::Math.new
end
(Rouge::Lexer.find(language) || Rouge::Lexers::PlainText).new (Rouge::Lexer.find(language) || Rouge::Lexers::PlainText).new
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment