Git Product home page Git Product logo

zhustec / jekyll-diagrams Goto Github PK

View Code? Open in Web Editor NEW
35.0 3.0 9.0 7.62 MB

A Jekyll plugin with support for Blockdiag, Erd, GraphViz, Mermaid, Nomnoml, PlantUML, Svgbob, Syntrax, Vega, Vega-Lite and WaveDrom.

Home Page: https://zhustec.github.io/jekyll-diagrams/

License: MIT License

Ruby 84.56% Dockerfile 3.45% Gherkin 11.98%
jekyll jekyll-plugin jekyll-diagrams graphviz blockdiag seqdiag nwdiag packetdiag rackdiag actdiag

jekyll-diagrams's People

Contributors

briankchan avatar marcus-held avatar mateuszkubuszok avatar zhustec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jekyll-diagrams's Issues

Update to Jekyll 4.0

Since Jekyll 4.0 go released today. I'd appreciate an update to support it. Executing bundle update resolves to:

Bundler could not find compatible versions for gem "jekyll":
  In Gemfile:
    jekyll-diagrams was resolved to 0.3.0, which depends on
      jekyll (~> 3.1.0)

Could not find a version that satisfies the requirement actiag (from versions: none)

> pip3 install blockdiag seqdiag actiag nwdiag        
Requirement already satisfied: blockdiag in c:\users\david\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (3.0.0)
Requirement already satisfied: seqdiag in c:\users\david\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (3.0.0)
ERROR: Could not find a version that satisfies the requirement actiag (from versions: none)
ERROR: No matching distribution found for actiag

Versions

Jekyll 4.3.2
pip 23.3.2
Python 3.11.7

Attempting some renderings:

With a blockdiag

> jekyll build  
   Jekyll Diagrams: Rendering Failed: blockdiag -T svg --nodoctype C:/Users/david/AppData/Local/Temp/input20240115-30984-5snpt4 -o C:/Users/david/AppData/Local/Temp/output20240115-30984-1db241.svg: ERROR: 'FreeTypeFont' object has no attribute 'getsize'

With seqdiag

> jekyll build  
   Jekyll Diagrams: Rendering Failed: seqdiag -T svg --nodoctype C:/Users/david/AppData/Local/Temp/input20240115-5732-usjpqh -o C:/Users/david/AppData/Local/Temp/output20240115-5732-na59hh.svg: ERROR: 'FreeTypeFont' object has no attribute 'getsize'

Support embedded Vega

It would be awesome if your library supported Vega and Vega-Lite without the need to install the cli tools but instead by embedding charts into the rendered website. I see two advantages. First, the user wouldn't need to install npm and the cli tools. Second, interactive charts would be interactive and not rendered as a static image.

Graphviz doesn't support UTF-8 and its output might break jekyll

Jekyll throws

/usr/local/bundle/gems/liquid-4.0.3/lib/liquid/block_body.rb:97:in `join': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)

in posts which use UTF-8 and embed graphviz images. Output of graphviz is recognized as us-ascii so if inserted into utf-8 document it results in error.

Forcing output of graphviz to be recognized as UTF-8 fix that (and it won't break things for posts which use us-ascii encoding only).

svg.sub!(@@xml_regex, '').force_encoding("utf-8")

Graphviz adds <!DOCTYPE> which isn't removed by plugin

After putting into markdown:

{% graphviz %}
digraph G {
  "commons" -> "domains"
  "domains" -> "application"
}
{% endgraphviz %}

I received:

<div class="graphviz"><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->
&lt;!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"&gt;
<!-- Generated by graphviz version 2.40.1 (0)
 -->
<!-- Title: G Pages: 1 -->
<svg width="137pt" height="188pt" viewBox="0.00 0.00 136.69 188.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 184)">
<title>G</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-184 132.6886,-184 132.6886,4 -4,4"></polygon>
<!-- commons -->
<g id="node1" class="node">
<title>commons</title>
<ellipse fill="none" stroke="#000000" cx="64.3443" cy="-162" rx="44.6926" ry="18"></ellipse>
<text text-anchor="middle" x="64.3443" y="-158.3" font-family="Times,serif" font-size="14.00" fill="#000000">commons</text>
</g>
<!-- domains -->
<g id="node2" class="node">
<title>domains</title>
<ellipse fill="none" stroke="#000000" cx="64.3443" cy="-90" rx="44.6926" ry="18"></ellipse>
<text text-anchor="middle" x="64.3443" y="-86.3" font-family="Times,serif" font-size="14.00" fill="#000000">domains</text>
</g>
<!-- commons&#45;&gt;domains -->
<g id="edge1" class="edge">
<title>commons-&gt;domains</title>
<path fill="none" stroke="#000000" d="M64.3443,-143.8314C64.3443,-136.131 64.3443,-126.9743 64.3443,-118.4166"></path>
<polygon fill="#000000" stroke="#000000" points="67.8444,-118.4132 64.3443,-108.4133 60.8444,-118.4133 67.8444,-118.4132"></polygon>
</g>
<!-- application -->
<g id="node3" class="node">
<title>application</title>
<ellipse fill="none" stroke="#000000" cx="64.3443" cy="-18" rx="64.189" ry="18"></ellipse>
<text text-anchor="middle" x="64.3443" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">application</text>
</g>
<!-- domains&#45;&gt;application -->
<g id="edge2" class="edge">
<title>domains-&gt;application</title>
<path fill="none" stroke="#000000" d="M64.3443,-71.8314C64.3443,-64.131 64.3443,-54.9743 64.3443,-46.4166"></path>
<polygon fill="#000000" stroke="#000000" points="67.8444,-46.4132 64.3443,-36.4133 60.8444,-46.4133 67.8444,-46.4132"></polygon>
</g>
</g>
</svg>
</div>

Since I've found no way of getting rid of <!DOCTYPE> using CLI options, this needs to be addressed in a plugins (or at least some config/workaround for it, needs to be provided).

Graphviz generation is slow

My blog is graphviz heavy and is rendering quite long

| Filename                                               | Count |     Bytes |   Time |
+--------------------------------------------------------+-------+-----------+--------+
| _layouts/post.html                                     |    32 |  3762.67K |  4.949 |
| _includes/header-navigation.html                       |    34 |   103.58K |  4.925 |
| _includes/toc.html                                     |    34 |    37.61K |  4.833 |
| _layouts/compiled.html                                 |     2 |   460.56K |  0.588 |
| _includes/main-post.html                               |    32 |  3508.99K |  0.180 |
| _posts/2018-06-01-speed-up-things-in-scalac-and-sbt.md |     1 |    28.80K |  0.071 |
| _includes/article.html                                 |    86 |  3915.01K |  0.058 |
| _posts/2019-04-29-from-string-to-ast-parsing.md        |     1 |   113.21K |  0.053 |
| _includes/recommended.html                             |    26 |    90.42K |  0.052 |
| tags.html                                              |     1 |   355.66K |  0.032 |
| index.html                                             |     1 |    48.83K |  0.028 |
| _includes/head.html                                    |    38 |   176.63K |  0.026 |
| _includes/translated_date.html                         |    33 |     0.38K |  0.012 |
| _includes/main-compiled.html                           |     2 |   444.04K |  0.012 |
| _posts/2018-08-06-kinds-of-types-in-scala-part-1.md    |     1 |    24.72K |  0.011 |
| compiled/kinds-of-types-in-scala.md                    |     1 |    65.17K |  0.009 |
| _layouts/standalone.html                               |     3 |   399.78K |  0.006 |
| feed.xml                                               |     1 |    13.08K |  0.005 |
| sitemap.xml                                            |     1 |    11.67K |  0.005 |
| series.html                                            |     1 |    24.31K |  0.002 |
| _includes/header-standalone.html                       |     1 |     2.05K |  0.002 |
| _includes/disqus.html                                  |    32 |     0.00K |  0.002 |
| _layouts/index.html                                    |     1 |    55.42K |  0.001 |
| _includes/footer.html                                  |     1 |     0.13K |  0.001 |
| _includes/main-standalone.html                         |     3 |   380.23K |  0.000 |
| 404.html                                               |     1 |     0.11K |  0.000 |
| robots.txt                                             |     1 |     0.14K |  0.000 |
| _includes/main-index.html                              |     1 |    48.90K |  0.000 |
+--------------------------------------------------------+-------+-----------+--------+
| TOTAL (for 28 files)                                   |   372 | 14072.09K | 15.863 |

                    done in 157.585 seconds.

however, I've noticed that a simple change to how Graphviz is rendered reduces it significantly

 Filename                                               | Count |     Bytes |   Time |
+--------------------------------------------------------+-------+-----------+--------+
| _includes/header-navigation.html                       |    34 |   103.58K |  6.279 |
| _layouts/post.html                                     |    32 |  3762.67K |  6.163 |
| _includes/toc.html                                     |    34 |    37.61K |  6.139 |
| _layouts/compiled.html                                 |     2 |   460.56K |  0.827 |
| _includes/main-post.html                               |    32 |  3508.99K |  0.204 |
| index.html                                             |     1 |    48.83K |  0.076 |
| _includes/article.html                                 |    86 |  3915.01K |  0.071 |
| _includes/recommended.html                             |    26 |    90.42K |  0.070 |
| _posts/2019-04-29-from-string-to-ast-parsing.md        |     1 |   113.21K |  0.060 |
| tags.html                                              |     1 |   355.66K |  0.044 |
| _includes/head.html                                    |    38 |   176.63K |  0.033 |
| _posts/2018-06-01-speed-up-things-in-scalac-and-sbt.md |     1 |    28.80K |  0.015 |
| compiled/kinds-of-types-in-scala.md                    |     1 |    65.17K |  0.011 |
| _includes/translated_date.html                         |    33 |     0.38K |  0.011 |
| _includes/main-compiled.html                           |     2 |   444.04K |  0.010 |
| _posts/2018-08-06-kinds-of-types-in-scala-part-1.md    |     1 |    24.72K |  0.009 |
| _layouts/standalone.html                               |     3 |   399.78K |  0.006 |
| sitemap.xml                                            |     1 |    11.67K |  0.005 |
| feed.xml                                               |     1 |    13.08K |  0.005 |
| series.html                                            |     1 |    24.31K |  0.003 |
| _layouts/index.html                                    |     1 |    55.42K |  0.003 |
| _includes/disqus.html                                  |    32 |     0.00K |  0.002 |
| _includes/header-standalone.html                       |     1 |     2.05K |  0.001 |
| _includes/main-standalone.html                         |     3 |   380.23K |  0.000 |
| _includes/footer.html                                  |     1 |     0.13K |  0.000 |
| 404.html                                               |     1 |     0.11K |  0.000 |
| robots.txt                                             |     1 |     0.14K |  0.000 |
| _includes/main-index.html                              |     1 |    48.90K |  0.000 |
+--------------------------------------------------------+-------+-----------+--------+
| TOTAL (for 28 files)                                   |   372 | 14072.09K | 20.046 |

                    done in 7.734 seconds.

that change is putting <?XML> stripping regexp in a global scope, so that it won't be created anew for each new image:

    class GraphvizRenderer
      DEFAULTS = {
        'engine'  => 'dot',
        'options' => '-Tsvg'
      }

      @@xml_regex = /^<!DOCTYPE(([^>]|\n)*)>(\n?)/ # for reuse

and

svg.sub! @@xml_regex, ''

This is a simple change, so I believe it can be safely merged (I can prepare PR later on) and in my case it brings speed up from 157.585s on clean build to 7.734s.

Support setting different width for graphviz

Using this, works quite well, thank you.

Right now graphviz width comes out as e.g. 356pt on the resulting `. Would be nice if I could set it to e.g. "100%", which would make the SVG automatically scale to width of content.

Jekyll 4 with Kramdown breaks the build

I recently tried installing jekyll-diagrams while using Jekyll 4.1.1 with Kramdown 2.3.0.

Attempts to build resulted in the Kramdown parser throwing an error:

  Conversion error: Jekyll::Converters::Markdown encountered an error while converting '_posts/2020-12-12-jekyll-diagrams-test.md/#excerpt':
                    Permission denied @ dir_s_mkdir - /home/krummja/krummja.github.io/.jekyll-cache/Jekyll/Cache/Jekyll--Converters--Markdown
   Jekyll Diagrams: Permission denied @ dir_s_mkdir - /home/krummja/krummja.github.io/.jekyll-cache/Jekyll/Cache/Jekyll--Converters--Markdown
  Conversion error: Jekyll::Converters::Markdown encountered an error while converting '_posts/2020-12-12-jekyll-diagrams-test.md':
                    uninitialized constant Kramdown::Utils::OrderedHash
Traceback (most recent call last):
	31: from /usr/local/bin/jekyll:23:in `<main>'
	30: from /usr/local/bin/jekyll:23:in `load'
	29: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/exe/jekyll:15:in `<top (required)>'
	28: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
	27: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
	26: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
	25: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
	24: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
	23: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
	22: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
	21: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `each'
	20: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
	19: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/build.rb:36:in `process'
	18: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/build.rb:65:in `build'
	17: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:28:in `process_site'
	16: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:80:in `process'
	15: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:207:in `render'
	14: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:515:in `render_docs'
	13: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:515:in `each_value'
	12: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:516:in `block in render_docs'
	11: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:516:in `each'
	10: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:517:in `block (2 levels) in render_docs'
	 9: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:532:in `render_regenerated'
	 8: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:63:in `run'
	 7: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:84:in `render_document'
	 6: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:100:in `convert'
	 5: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:100:in `reduce'
	 4: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:100:in `each'
	 3: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:102:in `block in convert'
	 2: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown.rb:85:in `convert'
	 1: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/cache.rb:109:in `getset'
/var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/cache.rb:88:in `[]': unhandled exception
	46: from /usr/local/bin/jekyll:23:in `<main>'
	45: from /usr/local/bin/jekyll:23:in `load'
	44: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/exe/jekyll:15:in `<top (required)>'
	43: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
	42: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
	41: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
	40: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
	39: from /var/lib/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
	38: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
	37: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
	36: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `each'
	35: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
	34: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/build.rb:36:in `process'
	33: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/build.rb:65:in `build'
	32: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:28:in `process_site'
	31: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:80:in `process'
	30: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:207:in `render'
	29: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:515:in `render_docs'
	28: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:515:in `each_value'
	27: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:516:in `block in render_docs'
	26: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:516:in `each'
	25: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:517:in `block (2 levels) in render_docs'
	24: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:532:in `render_regenerated'
	23: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:63:in `run'
	22: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:84:in `render_document'
	21: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:100:in `convert'
	20: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:100:in `reduce'
	19: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:100:in `each'
	18: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/renderer.rb:102:in `block in convert'
	17: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown.rb:85:in `convert'
	16: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/cache.rb:108:in `getset'
	15: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/cache.rb:111:in `rescue in getset'
	14: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown.rb:86:in `block in convert'
	13: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown/kramdown_parser.rb:109:in `convert'
	12: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown/kramdown_parser.rb:109:in `new'
	11: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/converters/markdown/kramdown_parser.rb:54:in `initialize'
	10: from /usr/lib/ruby/vendor_ruby/kramdown/parser/base.rb:69:in `parse'
	 9: from /var/lib/gems/2.7.0/gems/kramdown-parser-gfm-1.1.0/lib/kramdown/parser/gfm.rb:56:in `parse'
	 8: from /usr/lib/ruby/vendor_ruby/kramdown/parser/kramdown.rb:89:in `parse'
	 7: from /usr/lib/ruby/vendor_ruby/kramdown/parser/kramdown.rb:144:in `parse_blocks'
	 6: from /usr/lib/ruby/vendor_ruby/kramdown/parser/kramdown.rb:144:in `catch'
	 5: from /usr/lib/ruby/vendor_ruby/kramdown/parser/kramdown.rb:146:in `block in parse_blocks'
	 4: from /usr/lib/ruby/vendor_ruby/kramdown/parser/kramdown.rb:146:in `any?'
	 3: from /usr/lib/ruby/vendor_ruby/kramdown/parser/kramdown.rb:148:in `block (2 levels) in parse_blocks'
	 2: from /usr/lib/ruby/vendor_ruby/kramdown/parser/kramdown/html.rb:83:in `parse_block_html'
	 1: from /usr/lib/ruby/vendor_ruby/kramdown/parser/html.rb:89:in `handle_html_start_tag'
/usr/lib/ruby/vendor_ruby/kramdown/parser/html.rb:113:in `parse_html_attributes': uninitialized constant Kramdown::Utils::OrderedHash (NameError)

I can only fix this by regressing Kramdown to at least 1.17.0 (the release just before 2.0.0 where Hash was removed for OrderedHash), which requires regressing Jekyll to 3.9.0.

Ability to center generated images in post

Hello,
it would be super amazing to have the possibility to center generated images in the posts or pages. Could you maybe add a option to make this possible?

Best wishes,
Timo

Add filters support

Filter

  • as_graphviz

Usage

{% capture diagram %}
graph {
  a -> b;
}
{% endcapture %}

{{ diagram | as_graphviz }}

Mermaid block producing empty output

I'm trying to render the following Mermaid diagram:

---
---
[Content before]
{% mermaid %}
graph TD
  a[11]
  b[1100101]
  c[0110001]
{% endmermaid %}
[Content after]

that is producing the following output:

<!-- Rendered content before -->
<div class="jekyll-diagrams diagrams mermaid"></div>
<!-- Rendered content after -->

This diagram renders correctly on the live editor.

I followed all install steps, namely:

  1. Installed jekyll-diagrams and added it to Jekyll's config plugins array
  2. yarn global add mermaid.cli
  3. Checked jekyll-diagrams works by installing nomnoml and adding a test diagram.
  4. Set jekyll-diagrams.global.error_mode: ["raise"]

On a unrelated note, the Mermaid CLI authors discourage installing their CLI globally and instead recommend running yarn add mermaid.cli/npm install mermaid.cli.

Versions:
jekyll 4.0.0
jekyll-diagrams: 0.9.2
mermaid.cli: 0.5.1 (checked using mmdc --version, meaning it's added to the path)

Delete rendering temp directory using Jekyll hooks

Currently it delete rendering temp directory every time after it render a diagrams.

Use Jekyll.hooks can get rid of it.

Possible solution

Jekyll::Hooks.register :site, :post_render do |post|
  FileUtils.rm_rf(TEMP_DIR) if File.exist?(TEMP_DIR)
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.