feat: add support for inline SVG tags#221
Conversation
This is hackish draft of something that sends content as data URI. Fixes: max-heller#220
|
I just spent 2h chasing why diagrams out of So, in result what I'm getting right now: What leaves two more problem to solve:
|
There was a problem hiding this comment.
How to align the image inside the column?
I have yet to find a way to align images in Pandoc, see #42 (comment). Some writers support ad-hoc alignment annotations, but there's no canonical form. If we can set width/height appropriately, that might be enough to make things look reasonable.
How to deal with
<div...><style>svg {...}</style><svg>...</svg></div>wrapping the stuff we inline?
- The
<div>should already be getting ignored, which seems fine, though ideally we'd copy over the width/height thatmdbook-svgbobattaches to the<div>to the image itself (or maybe we could changemdbook-svgbobto add width/height to the SVG element itself?). - We might be able to parse that inline
<style>(there's some basic CSS parsing and handling already), but it doesn't seem critical here so we should be able to strip all<style>elements from non-HTML output formats.
| *<------+ PR merged | ||
| | | ||
| * v0.2.0 | ||
| ``` |
There was a problem hiding this comment.
How large is the HTML source of the SVG this generates? To keep the test pipeline simple, ideally we could inline the output of mdbook-svgbob to avoid needing to run it in CI. Also, once we're happy with this test, let's make it a test similar to the others in src/tests (maybe in src/tests/images.rs).

This is hackish draft of something that sends content as data URI.
The tree doesn't seem to keep slices referring to the original content for easy extraction, so the only way I find is to rebuild SVG content from the tree, but this is very hackish brutal recursive mechanism.
I'm getting incomplete image (just text and arrow tips) in the output PDF, but I'm not sure if the original SVG from
svgbobis correct in that context or the rebuilding tags doesn't omit some crucial parts.I'm really open to more suggestions here.
Fixes: #220