Permalink
Browse files

Support inline dot/graphviz

  • Loading branch information...
plexus committed Jun 6, 2013
1 parent 2e335db commit e98fcd8e2e8107e5a3065769996dea69d5839207
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/impress_renderer.rb
View
@@ -31,7 +31,16 @@ def hrule
end
def block_code code, lang
"<pre><code class='prettyprint #{lang}'>#{code}</code></pre>"
if lang == 'dot'
file = Tempfile.new(['mdpress','.dot'])
file << code
file.close
svg_file = file.path.gsub(%r{.*/},'')+'.svg'
puts `dot #{file.path} -Tsvg > ./presentation/#{svg_file}`
"<img src='#{svg_file}' />"
else
"<pre><code class='prettyprint #{lang}'>#{code}</code></pre>"
end
end
def codespan code
@@ -92,4 +101,3 @@ def doc_footer
}
end
end

0 comments on commit e98fcd8

Please sign in to comment.