lib/murdoc/paragraph.rb in murdoc-0.1.9 vs lib/murdoc/paragraph.rb in murdoc-0.1.10
- old
+ new
@@ -1,7 +1,11 @@
require "rubygems"
-require "rdiscount"
+begin
+ require "rdiscount"
+rescue LoadError
+ require "kramdown"
+end
require "cgi"
require "tempfile"
module Murdoc
class Paragraph
@@ -27,10 +31,14 @@
@source_type = source_type.to_s
end
def formatted_annotation
- Markdown.new(annotation, :smart).to_html
+ if defined?(Markdown)
+ Markdown.new(annotation, :smart).to_html
+ else
+ Kramdown.new(annotation, :input => :markdown).to_html
+ end
end
def formatted_source
@formatted_source ||= if pygments_installed? && options[:highlight_source]
IO.popen("pygmentize -l #{source_type} -O encoding=UTF8 -f html -O nowrap", "w+") do |pipe|
\ No newline at end of file