Sha256: 50b7aaf2d8a667ec4ef7cfcbe92fcff62596e57e64e72235fa7c2080e2a0b9ff
Contents?: true
Size: 819 Bytes
Versions: 1
Compression:
Stored size: 819 Bytes
Contents
# frozen_string_literal: true module Jekyll module Diagrams class MermaidBlock < Block CONFIGURATIONS = %w[theme width height backgroundColor configFile cssFile scale].freeze def render_svg(code, config) command = build_command(config) render_with_tempfile(command, code) do |input, output| "--input #{input} --output #{output}" end end def build_command(config) command = +'mmdc --puppeteerConfigFile ' command << Diagrams.vendor_path('mermaid_puppeteer_config.json') CONFIGURATIONS.each do |conf| command << " --#{conf} #{config[conf]}" if config.key?(conf) 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.9.3 | lib/jekyll-diagrams/mermaid.rb |