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

enable support for experimental diagramsnet in kroki #19

Merged
merged 3 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ plugins:
* `Enablebpmn` - Enable BPMN, default: True
* `EnableExcalidraw` - Enable Excalidraw, default: True
* `EnableMermaid` - Enable Mermaid, default: True
* `EnableDiagramsnet` - Enable diagrams.net (draw.io), default: False
* `HttpMethod` - Http method to use (`GET` or `POST`), default: `GET` (Note: you have to enable `DownloadImages` if you want to use `POST`!)
* `DownloadImages` - Download diagrams from kroki as static assets instead of just creating kroki links, default: False
* `DownloadDir` - The asset directory to place downloaded images in, default: images/kroki_generated
Expand Down
8 changes: 7 additions & 1 deletion kroki/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ class KrokiDiagramTypes():
"mermaid": ["png", "svg"],
}

kroki_diagramsnet = (
"diagramsnet": ["svg"],
)

def __init__(self, blockdiag_enabled, bpmn_enabled, excalidraw_enabled,
mermaid_enabled, file_types, file_type_overrides):
mermaid_enabled, diagramsnet_enabled, file_types, file_type_overrides):
diagram_types = self.kroki_base.copy()

if blockdiag_enabled:
Expand All @@ -55,6 +59,8 @@ def __init__(self, blockdiag_enabled, bpmn_enabled, excalidraw_enabled,
diagram_types.update(self.kroki_excalidraw)
if mermaid_enabled:
diagram_types.update(self.kroki_mermaid)
if diagramsnet_enabled:
diagram_types.update(self.kroki_diagramsnet)

self.diagram_types_supporting_file = {}

Expand Down
2 changes: 2 additions & 0 deletions kroki/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class KrokiPlugin(BasePlugin):
('Enablebpmn', config.config_options.Type(bool, default=True)),
('EnableExcalidraw', config.config_options.Type(bool, default=True)),
('EnableMermaid', config.config_options.Type(bool, default=True)),
('EnableDiagramsnet', config.config_options.Type(bool, default=False)),
('HttpMethod', config.config_options.Type(str, default='GET')),
('DownloadImages', config.config_options.Type(bool, default=False)),
('EmbedImages', config.config_options.Type(bool, default=False)),
Expand All @@ -47,6 +48,7 @@ def on_config(self, config, **_kwargs):
self.config['Enablebpmn'],
self.config['EnableExcalidraw'],
self.config['EnableMermaid'],
self.config['EnableDiagramsnet'],
self.config['FileTypes'],
self.config['FileTypeOverrides'])

Expand Down