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

Support latest es module mermaid, add support for ELK diagrams #151

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

timkpaine
Copy link
Collaborator

@timkpaine timkpaine commented Sep 10, 2024

ES Modules

Mermaid moved to es modules on version 10.3. As a first pass, I allowed for either >10.3 with code to use modules, or less than 10.3 and keep the existing code. This ended up pretty messy, so this PR officially removes support for mermaid<10.3.0. This is a breaking change.

Explicit local files

I added explicit options for mermaid_use_local, mermaid_elk_use_local, and d3_use_local, to disambiguate the usage of mermaid_version.

New Zoom

This is a little more complicated because I noticed a race condition between mermaid's auto initialization and the d3 processing step on window load. So now they're guaranteed sequential by forcing mermaid to run first, then doing a followup run to add zoom to either all mermaids on the page, or just those that have been annotated with :zoom:

Frontmatter

Mermaid frontmatter is working, albeit with a compromise of exploiting yaml/json compatibility. Thankfully, this works fine across sphinx/github:

```mermaid
---
title: Hello Title
config: {"theme": "base", "themeVariables": {"primaryColor": "#00ff00"}}
---
flowchart
	Hello --> World
```

GitHub

---
title: Hello Title
config: {"theme": "base", "themeVariables": {"primaryColor": "#00ff00"}}
---
flowchart
	Hello --> World
Loading

Sphinx
Screenshot 2024-09-11 at 18 07 19

Docs

I validated that html/pdf docs worked locally including zoom. I added some information:

  • new configuration options
  • how to make github/sphinx treat mermaid directive the same (e.g. s/{mermaid}/mermaid)

@timkpaine timkpaine marked this pull request as draft September 10, 2024 03:08
@timkpaine timkpaine force-pushed the tkp/esmelk branch 3 times, most recently from 9edc62a to 3f3e37e Compare September 10, 2024 04:29
@timkpaine timkpaine marked this pull request as ready for review September 10, 2024 04:30
@timkpaine timkpaine marked this pull request as draft September 10, 2024 05:34
@timkpaine timkpaine marked this pull request as ready for review September 10, 2024 21:08
@timkpaine timkpaine force-pushed the tkp/esmelk branch 2 times, most recently from 6572cf5 to 50a171e Compare September 10, 2024 21:22
@mgaitan
Copy link
Owner

mgaitan commented Sep 10, 2024

@timkpaine amazing . could you update the README and maybe add an example to the doc?

@timkpaine timkpaine force-pushed the tkp/esmelk branch 2 times, most recently from 61dbd85 to efb4b33 Compare September 11, 2024 22:07
@timkpaine timkpaine marked this pull request as draft September 11, 2024 22:13
@timkpaine timkpaine force-pushed the tkp/esmelk branch 3 times, most recently from d09a95d to d026076 Compare September 11, 2024 22:31
@timkpaine timkpaine marked this pull request as ready for review September 11, 2024 23:52
@mgaitan mgaitan merged commit a0876c7 into mgaitan:master Sep 12, 2024
15 checks passed
@timkpaine timkpaine deleted the tkp/esmelk branch September 12, 2024 13:33
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 YAML frontmatter configuration Allow use of local d3 distribution
2 participants