bauglir / Kroki.jl

Supports creating a variety of diagrams through the https://kroki.io service.

Home Page:https://bauglir.github.io/Kroki.jl/stable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow specific output format to be disabled for specific diagram types

bauglir opened this issue · comments

A suggestion from sparring with @baggepinnen.

Kroki tries to select the most suitable output format to render a diagram in using Julia's Base.show and AbstractDisplay capabilities. Situations may occur where the "best" output format that gets determined is not actually the "best" output format, e.g. text getting cut off for Mermaid diagrams rendered to SVGs as shown in the documentation.

For cases like this it would be nice if there was a way to specify a preference as to which output formats to use. Currently, this can be achieved in a more or less blunt manner by setting Base.showable(::MIME"...", ::Diagram) = false which disables the specific MIME type for all diagram types (which would also be type piracy when done from within other packages).

Perhaps a "preference registry" that Base.showable can query based on the diagram.type and the provided MIME type with an appropriate API would be a good solution.