Sha256: f9cdc076b25a618760d807e39060c71ed533d86d95ba92d2b59840a51c20cb40
Contents?: true
Size: 935 Bytes
Versions: 1
Compression:
Stored size: 935 Bytes
Contents
module Jekyll module Diagrams class MermaidBlock < Block CONFIGURATIONS = { 'theme' => 'default', 'width' => 800, 'height' => 600, 'backgroundColor' => 'white' }.freeze def render_svg(code, config) render_with_tempfile(build_command(config), code) do |command, input, output| "#{command} --input #{input} --output #{output}" end end def build_command(config) command = 'mmdc' command << ' --transparent' if config.has_key?('transparent') command << " --puppeteerConfigFile #{Util.vendor_path('mermaid_puppeteer_config.json')}" CONFIGURATIONS.merge(config).each do |conf, value| command << " --#{conf} #{value}" end command end end end end Liquid::Template.register_tag(:mermaid, Jekyll::Diagrams::MermaidBlock)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-diagrams-0.7.1 | lib/jekyll-diagrams/mermaid.rb |