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

Add support for kroki diagrams #4381

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

UFOMelkor
Copy link
Contributor

@UFOMelkor UFOMelkor commented May 28, 2023

This might be at least ready for discussion.

It adds a renderer for kroki that directly renders diagrams as external images.

So a diagram like this

```blockdiag
blockdiag {
  Kroki -> generates -> "Block diagrams";
  Kroki -> is -> "very easy!";
  Kroki [color = "greenyellow"];
  "Block diagrams" [color = "pink"];
  "very easy!" [color = "orange"];
}
```

will be rendered as

<img src="https://kroki.io/blockdiag/svg/eNpdzEEKwjAQheF9T_GafU8guui2RxAXYzuEkJgpE1GCeHcZdDG4fLyP_1pkzVuiiNcALCo5YTohcmWlOzcbYTYEU0q3Fg5epi95sHYwtT66-7xKEcURISpz7VyKPMPFwH_T2T3V_EOu6oAo1chG3h-IfzvN"/>

Kroki supports the following formats:

  • BlockDiag
  • BPMN
  • Bytefield
  • SeqDiag
  • ActDiag
  • NwDiag
  • PacketDiag
  • RackDiag
  • C4 with PlantUML
  • D2
  • DBML
  • Ditaa
  • ERD
  • Excalidraw
  • GraphViz
  • Mermaid
  • Nomnoml
  • Pikchr
  • PlantUML
  • Structurizr
  • Svgbob
  • TikZ
  • Vega
  • Vega-Lite
  • WaveDrom
  • WireViz

Although this renderer could possibly render mermaid diagram, it is added after the mermaid renderer, so the latter one will render this in Zettlr.

I ignored caption and width attributes for now. IMHO this makes more sense to handle after the parsing of pandoc attributes has been done.

A general dark mode is currently not supported by kroki (see yuzutech/kroki#1281). For PlantUML I manually added a rudimentary dark mode.

Resolves #4375

@UFOMelkor UFOMelkor force-pushed the kroki-support branch 2 times, most recently from 3a61850 to c21876d Compare May 30, 2023 04:20
@UFOMelkor UFOMelkor marked this pull request as ready for review May 30, 2023 04:20
@UFOMelkor UFOMelkor force-pushed the kroki-support branch 2 times, most recently from 9d82e88 to a7d25ac Compare June 29, 2023 11:22
@dustdfg
Copy link

dustdfg commented Feb 22, 2024

It doesn't seem to me a very good idea to use external site. Local tool is better IMO. IIUC you just try to get a generated svg file from kroki.io. Is it right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for kroki/pikchr
2 participants