Sha256: aa95fd78e6917538f0857e4ee7ef014320115e895af6474dfbf6844a9e3c58be

Contents?: true

Size: 578 Bytes

Versions: 17

Compression:

Stored size: 578 Bytes

Contents

YARD::Templates::Engine.register_template_path(File.dirname(__FILE__) + '/templates')

require 'pygments.rb'

module YARD
  module Templates
    module Helpers
      module HtmlSyntaxHighlightHelper
        def html_syntax_highlight_ruby(source)
          highlight_with_pygments(:ruby, source)
        end

        private

        def highlight_with_pygments(language, source)
          html = Pygments.highlight(source, lexer: language.to_s)
          html.sub(%r{\A<div class="highlight">\s*<pre>}, '').sub(%r{</pre>\s*</div>\Z}, '')
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
shoulda-matchers-3.1.3 doc_config/yard/setup.rb
shoulda-matchers-4.0.0.rc1 doc_config/yard/setup.rb
shoulda-matchers-3.1.2 doc_config/yard/setup.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/shoulda-matchers-2.8.0/doc_config/yard/setup.rb
shoulda-matchers-3.1.1 doc_config/yard/setup.rb
shoulda-matchers-3.1.0 doc_config/yard/setup.rb
shoulda-matchers-3.0.1 doc_config/yard/setup.rb
shoulda-matchers-3.0.0 doc_config/yard/setup.rb
shoulda-matchers-3.0.0.rc1 doc_config/yard/setup.rb
shoulda-matchers-2.8.0 doc_config/yard/setup.rb
shoulda-matchers-2.8.0.rc2 doc_config/yard/setup.rb
shoulda-matchers-2.8.0.rc1 doc_config/yard/setup.rb
shoulda-matchers-2.7.0 doc_config/yard/setup.rb
shoulda-matchers-2.6.2 doc_config/yard/setup.rb
mcmire-shoulda-matchers-2.6.2.docs.1 doc_config/yard/setup.rb
mcmire-shoulda-matchers-2.6.1.docs.1 doc_config/yard/setup.rb
mcmire-shoulda-matchers-2.5.0 doc_config/yard/setup.rb