Sha256: 5e3f838aae97367e05bbe4a443863d46e1646d9ac76430e88bc38156254f8f41

Contents?: true

Size: 659 Bytes

Versions: 5

Compression:

Stored size: 659 Bytes

Contents

module SDocHelpers
  module MarkdownFiles
    def description
      return super unless full_name =~ /\.(md|markdown)$/
      # assuming your path is ROOT/html or ROOT/doc
      path = Dir.pwd + '/../' + full_name
      Markdown.new(File.read(path)).to_html + open_links_in_new_window
    end

    def open_links_in_new_window
      <<-html
<script type="text/javascript">$(function() {
  $('a').each(function() { $(this).attr('target', '_blank') })
})</script>
html
    end
  end
end

begin
  require 'rdiscount'
  RDoc::TopLevel.send :include, SDocHelpers::MarkdownFiles
rescue LoadError
  puts "Markdown support not enabled. Please install RDiscount."
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sdoc-helpers-0.1.4 lib/sdoc_helpers/markdown.rb
sdoc-helpers-0.1.3 lib/sdoc_helpers/markdown.rb
sdoc-helpers-0.1.2 lib/sdoc_helpers/markdown.rb
sdoc-helpers-0.1.1 lib/sdoc_helpers/markdown.rb
sdoc-helpers-0.1.0 lib/sdoc_helpers/markdown.rb