asciidoctor / asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!

Home Page:https://kroki.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to save png files locally?

ivanmanning opened this issue · comments

Hi,

On the documentation page, it says that by default, Asciidoctor Kroki generates a link, to a Kroki server or a local file. To change the default for SVG diagrams, set the kroki-default-options attribute.

So, how can I make it to save the images locally, and use that image instead of the link to the Kroki server?
Thanks.

Here is my test example:

= BOOK title
:chapter: 6
:sectnums:
:figure-caption: {chapter}.
:listing-caption: {chapter}.
:table-caption: {chapter}.
:leveloffset: 1
:imagesoutdir: E:\images\test
:kroki-default-options: inline

= CHAPTER title

Diagram test

[graphviz, "abcd-flowchart", svg]
----
digraph G { rankdir=LR; Graphviz->AsciiDoc->HTML}
----

And this is the command I'm using to create XML file:

asciidoctor -r asciidoctor-kroki -b docbook test.adoc

And this is the result I get:

<?xml version="1.0" encoding="UTF-8"?>
<?asciidoc-toc?>
<?asciidoc-numbered?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en">
<info>
<title>BOOK title</title>
<date>2022-04-29</date>
</info>
<section xml:id="_chapter_title">
<title>CHAPTER title</title>
<simpara>Diagram test</simpara>
<informalfigure role="kroki">
<mediaobject>
<imageobject>
<imagedata fileref="https://kroki.io/graphviz/svg/eNpLyUwvSizIUHBXqFYoSszLTskssvUJslZwB4mWZVbp2jkWJ2dmuuQn69p5hPj61AIArUgQ9Q=="/>
</imageobject>
<textobject><phrase>abcd-flowchart</phrase></textobject>
</mediaobject>
</informalfigure>
</section>
</article>

This feature is not implemented in the Ruby extension, see: #156

Thank you for your reply, I appreciate it.
Do you have in plan to implement it? And when?

I don't have time right now but feel free to submit a pull request.

I'd love to but I'm not a Ruby developer

I wasn't either before I start contributing to Asciidoctor. That's a good opportunity to learn a new language!