BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
aa2c437f
Commit
aa2c437f
authored
Dec 08, 2016
by
Munken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hacked in Math Lexer
parent
525c2a78
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
syntax_highlight_filter.rb
lib/banzai/filter/syntax_highlight_filter.rb
+27
-0
No files found.
lib/banzai/filter/syntax_highlight_filter.rb
View file @
aa2c437f
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
Filter
# HTML Filter to highlight fenced code blocks
...
...
@@ -48,6 +72,9 @@ module Banzai
end
def
lexer_for
(
language
)
if
language
==
'math'
return
Rouge
::
Lexers
::
Math
.
new
end
(
Rouge
::
Lexer
.
find
(
language
)
||
Rouge
::
Lexers
::
PlainText
).
new
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment