1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/doc_config/yard/setup.rb

23 lines
516 B
Ruby
Raw Normal View History

2014-06-19 22:44:06 -06:00
YARD::Templates::Engine.register_template_path(File.dirname(__FILE__) + '/templates')
2020-08-30 15:46:33 +05:30
require 'rouge'
2014-06-19 22:44:06 -06:00
module YARD
module Templates
module Helpers
module HtmlSyntaxHighlightHelper
def html_syntax_highlight_ruby(source)
2020-08-30 15:46:33 +05:30
highlight(:ruby, source)
2014-06-19 22:44:06 -06:00
end
private
2020-08-30 15:46:33 +05:30
def highlight(language, source)
lexer = Rouge::Lexers.const_get(language.capitalize)
Rouge::Formatters::HTML.new.format(lexer.new.lex(source))
2014-06-19 22:44:06 -06:00
end
end
end
end
end