From d0fea7851ad6612c42550bd89112392619273f0c Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 15 Sep 2023 21:14:06 +0100 Subject: [PATCH] Extract out diagram types --- hooks/kroki.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hooks/kroki.py b/hooks/kroki.py index 05ebf0e..be93514 100644 --- a/hooks/kroki.py +++ b/hooks/kroki.py @@ -13,6 +13,11 @@ from scour.scour import scourString logger = get_plugin_logger("kroki") +DIAGRAM_TYPES = { + "blockdiag", + "mermaid" +} + DIAGRAM_CACHE_TIME = timedelta(days=7) def get_kroki_diagram(source, language): @@ -49,15 +54,11 @@ def on_config(config): custom_fences = [ { - "name": "blockdiag", - "class": "blockdiag", - "format": partial(fence_div_format, config["site_dir"]) - }, - { - "name": "mermaid", - "class": "mermaid", + "name": diagram, + "class": diagram, "format": partial(fence_div_format, config["site_dir"]) } + for diagram in DIAGRAM_TYPES ] config.mdx_configs["pymdownx.superfences"] = {