Class: Jekyll::Diagrams::MermaidRenderer
- Inherits:
-
BasicRenderer
- Object
- BasicRenderer
- Jekyll::Diagrams::MermaidRenderer
- Defined in:
- lib/jekyll-diagrams/mermaid/renderer.rb
Constant Summary collapse
- CONFIGURATIONS =
%w[theme width height backgroundColor configFile cssFile scale].freeze
Instance Method Summary collapse
Methods inherited from BasicRenderer
Methods included from Rendering
render_with_command, render_with_stdin_stdout, render_with_tempfile
Constructor Details
This class inherits a constructor from Jekyll::Diagrams::BasicRenderer
Instance Method Details
#build_command(config) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jekyll-diagrams/mermaid/renderer.rb', line 17 def build_command(config) command = +'mmdc --puppeteerConfigFile ' command << Utils.vendor_path('mermaid_puppeteer_config.json') CONFIGURATIONS.each do |conf| command << " --#{conf} #{config[conf]}" if config.key?(conf) end command end |
#render_svg(code, config) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/jekyll-diagrams/mermaid/renderer.rb', line 9 def render_svg(code, config) command = build_command(config) render_with_tempfile(command, code) do |input, output| "--input #{input} --output #{output}" end end |