Sha256: 259eb39ed94edad04d707ab65796e4b2e79b54f577d30d6fa0c2791f7775be3c

Contents?: true

Size: 635 Bytes

Versions: 1

Compression:

Stored size: 635 Bytes

Contents

module Slippery
  module Processors
    class AddHighlight

      DEFAULT_STYLE   = :default
      DEFAULT_VERSION = '8.0'

      def initialize(style = DEFAULT_STYLE, version = DEFAULT_VERSION)
        @style = style
        @version = version
      end

      def call(doc)
        doc.rewrite 'head' do |head|
          head <<= H[:link, rel: "stylesheet", href: "http://yandex.st/highlightjs/#{@version}/styles/#{@style}.min.css"]
          head <<= H[:script, src: "http://yandex.st/highlightjs/#{@version}/highlight.min.js"]
          head <<= H[:script, 'hljs.initHighlightingOnLoad();']
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slippery-0.3.0 lib/slippery/processors/add_highlight.rb