Skip to content

Conversation

@Feez2403
Copy link
Contributor

@Feez2403 Feez2403 commented Jul 31, 2025

Pre-flight checklist

Motivation

When using mermaid, we can change the layout of the diagram using ELK (Eclipse Layout Kernel). This layout becomes handy when working with large or intricate diagrams.
However, for rendering using ELK on web pages, we need to import an additional package, as stated in the official Mermaid github documentation.

Test Plan

We create additional diagrams on dogfood (/tests/pages/diagrams)

Diagram using Dagre (default Mermaid layout manager)
image

Diagram using ELK
image

The ELK layout is applied successfully.

Test links

We added diagrams to the dogfooding page :
website_dogfooding_pages tests\diagrams.mdx
access on : https://deploy-preview-11357--docusaurus-2.netlify.app/tests/pages/diagrams#elk-er-diagram-layout

Related issues/PRs

Mermaid ELK layouts not activated #11351

@meta-cla meta-cla bot added the CLA Signed Signed Facebook CLA label Jul 31, 2025
@netlify
Copy link

netlify bot commented Jul 31, 2025

[V2]

Name Link
🔨 Latest commit e987b2d
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/68ab4d54d02d490008ed99dd
😎 Deploy Preview https://deploy-preview-11357--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link

github-actions bot commented Jul 31, 2025

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🟠 52 🟢 98 🟢 100 🟢 100 Report
/docs/installation 🟠 54 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 69 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 58 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 58 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 59 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 69 🟢 100 🟢 100 🟠 86 Report

"@docusaurus/types": "3.8.1",
"@docusaurus/utils-validation": "3.8.1",
"mermaid": ">=11.6.0",
"@mermaid-js/layout-elk": "^0.1.8",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this dependency optional?

This package is large, and there are also license concerns: mermaid-js/mermaid#5654

We don't want existing Docusaurus sites under MIT license to implicitly change their license while upgrading to the next minor version

import type {ThemeConfig} from '@docusaurus/theme-mermaid';

// mermaid does not support ELK layouts in external websites (e.g. Docusaurus) by default, as explained in https://github.com/mermaid-js/mermaid/tree/develop/packages/mermaid-layout-elk
mermaid.registerLayoutLoaders(elkLayouts);
Copy link
Collaborator

@slorber slorber Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could do something like:

try {
  mermaid.registerLayoutLoaders(require("@mermaid-js/layout-elk"));
} catch (e) {
  // Ignore
}

@slorber slorber changed the title Fix/mermaid elk not activated #11351 feat(mermaid): support elk layout Aug 1, 2025
@slorber slorber added the pr: new feature This PR adds a new API or behavior. label Aug 1, 2025
@socket-security
Copy link

socket-security bot commented Aug 24, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedtinypool@​1.1.11001007683100
Added@​total-typescript/​shoehorn@​0.1.21001009976100
Updatedcore-js@​3.42.0 ⏵ 3.45.194 +110099 +191 +1100

View full report

@slorber slorber merged commit 3059107 into facebook:main Aug 24, 2025
42 checks passed
@slorber slorber linked an issue Aug 24, 2025 that may be closed by this pull request
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mermaid ELK layouts not activated

2 participants