Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
lib/banzai/filter/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