Graphdown
Markdown extension for embedding graphs.
Installation
$ gem install graphdown
Requirements
Usage
require "redcarpet"
require "graphdown"
class BaseRenderer < Redcarpet::Render::HTML
include Graphdown::Renderable
# include other extensions
end
markdown = Redcarpet::Markdown.new(BaseRenderer, fenced_code_blocks: true)
markdown.render(content)
Example
# Views transition
\```dot
digraph sample {
A [label = "index.html"];
B [label = "show.html"];
C [label = "new.html"];
A -> B [dir = both];
A -> C;
C -> A [label = "redirect"];
}
\```
- Users visit show.html from index.html.
- Users visit index.html from show.html.
- Users visit new.html from index.html.
- Users are redirected to index.html from new.html.
Graphdown parses block codes which language is 'dot' into img tags, which load graph PNG image. The image is generated by Graphviz.