question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Mermaid's callback configuration

See original GitHub issue

Mermaid has the ability (see src/mermaid.js) to invoke a user-configured callback function as it renders each diagram:

mermaid.initialize({
  startOnLoad: true,
  mermaid: {
    callback: function(id) {
      // ...
    },
  },
});

This is invaluable for doing any number of things on Mermaid diagrams that simply cannot be done with CSS.

Right now, I don’t see any way to configure a Mermaid callback function in this plugin. Could that be supported in the plugin configuration? The obvious way would seem to be as follows:

plugins:
  - mermaid2:
      arguments:
        theme: neutral
      callback: myMermaidCallbackFunction

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
fralaucommented, Aug 7, 2020

It’s now published on pypi under 0.3.1.

1reaction
artobcommented, Aug 4, 2020

Could you let me know if it works for you? If it works OK, I will update the pypi repository.

Great! That works 👍

  1. How did you find out about this mermaid>callback argument for the mermaid.initialize() function? I could not find any mention about this on the official website.

Hmm, I can’t recall. Probably from examples in the wild, or Mermaid issues.

  1. For the record (not tested and no idea whether this could possibly be useful): instead of a javascript function name, would it be possible to write its code directly, something like.

Sure, I think that’d be nice for all those users who don’t plan to add any other custom JS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mermaid - Generation of diagrams and flowcharts from text in ...
Using the mermaid.init call. Is it possible to set some configuration via the mermaid object. The two parameters that are supported using this...
Read more >
Mermaid | Diagramming and charting tool
JavaScript based diagramming and charting tool that renders Markdown-inspired text definitions to create and modify diagrams dynamically.
Read more >
How to use the mermaid.mermaidAPI.render function in ... - Snyk
To help you get started, we've selected a few mermaid. ... merge(defaultConfig, config) mermaidAPI.initialize(mermaidConfig) const doc = children.
Read more >
Rendering Mermaid Charts - Markdown Monster Documentation
Enable Mermaid Rendering (Tools | Settings | Mermaid Diagrams) · You may have to restart Markdown Monster for the change in settings to...
Read more >
Using Mermaid Flowcharts In Obsidian ‍♀️️ - YouTube
CHECK THESE OUT ◀︎▭▭▭▭▭▭▭▭▭▭📧️ NEWSLETTER: https://bryanjenkstech.ck.page/d4ec0713d5 DISCORD: https://discord.gg/MxCVshN🗣️ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found