Discussion:
[hakyll] Image generation from in-line graphviz source
Jasper Van der Jeugt
2015-05-15 17:43:50 UTC
Permalink
A simpler solution here is probably inlining the images.

<img alt="Embedded Image"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />

Hope this helps,
Peace,
Jasper
Hi,
I'm relatively new to Hakyll, and I'd appreciate some guidance how to
implement a Pandoc transformer that renders in-line Graphviz code blocks
as PNG images. Basically, I'd like to contain my Markdown documents
| ~~~~~~~~~~~ {inline="dot"}
| digraph g {
| rankdir = LR
| 0 [label = "0"]
| 1 [label = "1"]
| 0 -> 1 [label = "1"]
| 0 -> 0 [label = "0"]
| 1 -> 1 [label = "1"]
| 1 -> 0 [label = "0"]
| }
| ~~~~~~~~~~~
Now, the output HTML document should show an image of the rendered
graph, of course, and I reckoned this can be implemented in a
transformer for 'pandocCompilerWithTransformM'. My problem is, though,
that while compiling the document, say "foo.mdwn", I have to create
output rules for all the graphs I've encountered, i.e.
"foo-graph-1.png", "foo-graph-2.png", and so on. I'm not sure how that
would be accomplished, because it seems like a Compiler (Item a)
computation cannot produce more than one output item.
Looking at the API, I believe that "versions" may be the answer to this
problem, but I', not really sure and I haven't found any documentation
yet that explains what versions really are and how they're supposed to
be used. So I wonder: am I on the right track with that approach?
Is there an altogether simpler solution that I've overlooked? Has anyone
implemented something like this already?
I'd appreciate any advice and feedback I can get.
Best regards,
Peter
--
You received this message because you are subscribed to the Google Groups
"hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jasper Van der Jeugt
2015-05-29 10:41:02 UTC
Permalink
Hey Peter,

I think the "proper" way to do this would be creating a new datatype
which holds the contents of multiple files, and then add a nice
`Writable` instance.

Peace,
Jasper
Hi Jasper,
Post by Jasper Van der Jeugt
A simpler solution here is probably inlining the images.
<img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />
oh, very cool. I had no idea that this is possible!
Out of curiosity, though, what approach would I have to take with Hakyll
to extract an unknown number of source files from another source file in
a proper way? Is there a way to do that?
Best regards,
Peter
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...