Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkdocs-kroki-plugin 0.8.1 doesn't work anymore with Backstage techdoc #70

Closed
jonesbusy opened this issue Jun 24, 2024 · 4 comments · Fixed by #73
Closed

mkdocs-kroki-plugin 0.8.1 doesn't work anymore with Backstage techdoc #70

jonesbusy opened this issue Jun 24, 2024 · 4 comments · Fixed by #73

Comments

@jonesbusy
Copy link

Hi,

Mkdoc material works well on 0.8.1 and we have finally the fonts loaded (thanks for this!)

But after this upgrade the mkdocs-kroki-plugin to version 0.8.1 it doesn't work anymore with Backstage techdoc.

We are including our excalidraw like this

kroki-excalidraw
@from_file:test.excalidraw

I didn't found any relevant logs, but I've setup a reproduction repo here https://github.com/jonesbusy/mkdocs-kroki-backstage

Using the version 0.8.1 the diagram is just no displayed at all.

It's not only the preview but also when building techdoc https://backstage.io/docs/features/techdocs/how-to-guides/#how-to-add-mermaid-support-in-techdocs

I'm not sure if it's something what must be fixed on Backstage side of should be adatped on the mkdocs-kroki-plugin

I'm not sure which one of the 2 PR included between 0.8.0 and 0.8.1 cause this issue

@jonesbusy jonesbusy mentioned this issue Jun 26, 2024
3 tasks
@netmMDHemmings
Copy link

This is because in 0.8.1 there was a switch to using <object> tags for the generated images, for example:

<object name="Kroki" type="image/svg+xml" data="https://someurl/somedata" style="max-width:100%"></object>

Whereas previously in 0.8.0 it was <img> tags:

<p><img alt="Kroki" src="https://someurl/somedata" /></p>

And the techdocs plugin for Backstage strips out <object> tags because they're deemed unsafe (and has done for about three years now) -> GHSA-gg96-f8wr-p89f

So the workaround for now would be to downgrade to 0.8.0

@jonesbusy
Copy link
Author

Thanks. Explanation has also been given #66

I think it would be better to use the svg tag instead of object which should work the same

@oniboni
Copy link
Collaborator

oniboni commented Jun 28, 2024

I've tried to use the svg tags directly, sadly the different diagram generators produce different types of svg data, sometimes with a viewport setting, sometimes with hard width and height, that interferes with the layout.

Maybe the option whether to use img tags should be settable via a config option?

I can try out some other approaches, when I'm well and fit again 🤒

Thank you all for the clues and leads 🕵️

@jonesbusy
Copy link
Author

Sure, that would be nice to have a config option for the format like the plantuml markdown : https://github.com/mikitex70/plantuml-markdown

svg (like 0.8.0)
svg_object (like 0.8.1)
svg_inline

Take care

@oniboni oniboni linked a pull request Jul 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants