Add elk layout support to mermaid (#36486)

Fixes: https://github.com/go-gitea/gitea/issues/34769

This allows the user to opt-in to using `elk` layouts using either YAML
frontmatter or `%%{ init` directives inside the markup code block. The
default layout is not changed.

---------

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwind
2026-02-07 03:22:57 +01:00
committed by GitHub
parent e2104a1dd5
commit 49e6d5f6d6
5 changed files with 197 additions and 12 deletions
+19
View File
@@ -53,6 +53,9 @@ importers:
'@mcaptcha/vanilla-glue':
specifier: 0.1.0-alpha-3
version: 0.1.0-alpha-3
'@mermaid-js/layout-elk':
specifier: 0.2.0
version: 0.2.0(mermaid@11.12.2)
'@primer/octicons':
specifier: 19.21.2
version: 19.21.2
@@ -805,6 +808,11 @@ packages:
'@mcaptcha/vanilla-glue@0.1.0-alpha-3':
resolution: {integrity: sha512-GT6TJBgmViGXcXiT5VOr+h/6iOnThSlZuCoOWncubyTZU9R3cgU5vWPkF7G6Ob6ee2CBe3yqBxxk24CFVGTVXw==}
'@mermaid-js/layout-elk@0.2.0':
resolution: {integrity: sha512-vjjYGnCCjYlIA/rR7M//eFi0rHM6dsMyN1JQKfckpt30DTC/esrw36hcrvA2FNPHaqh3Q/SyBWzddyaky8EtUQ==}
peerDependencies:
mermaid: ^11.0.2
'@mermaid-js/parser@0.6.3':
resolution: {integrity: sha512-lnjOhe7zyHjc+If7yT4zoedx2vo4sHaTmtkl1+or8BRTnCtDmcTpAjpzDSfCZrshM5bCoz0GyidzadJAH1xobA==}
@@ -2257,6 +2265,9 @@ packages:
electron-to-chromium@1.5.283:
resolution: {integrity: sha512-3vifjt1HgrGW/h76UEeny+adYApveS9dH2h3p57JYzBSXJIKUJAvtmIytDKjcSCt9xHfrNCFJ7gts6vkhuq++w==}
elkjs@0.9.3:
resolution: {integrity: sha512-f/ZeWvW/BCXbhGEf1Ujp29EASo/lk1FDnETgNKwJrsVvGZhUWCZyg3xLJjAsxfOmt8KjswHmI5EwCQcPMpOYhQ==}
emoji-regex@10.6.0:
resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==}
@@ -4744,6 +4755,12 @@ snapshots:
dependencies:
'@mcaptcha/core-glue': 0.1.0-alpha-5
'@mermaid-js/layout-elk@0.2.0(mermaid@11.12.2)':
dependencies:
d3: 7.9.0
elkjs: 0.9.3
mermaid: 11.12.2
'@mermaid-js/parser@0.6.3':
dependencies:
langium: 3.3.1
@@ -6172,6 +6189,8 @@ snapshots:
electron-to-chromium@1.5.283: {}
elkjs@0.9.3: {}
emoji-regex@10.6.0: {}
emoji-regex@8.0.0: {}