How to use the mermaid.mermaidAPI.initialize function in mermaid

To help you get started, we’ve selected a few mermaid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github crubier / code-to-graph / docs-source / src / attina.js View on Github external
function getDiagram(title, input, callback) {
  try {
    mermaidAPI.initialize({
      startOnLoad: true
    });

    mermaidAPI.parseError = function(err, hash) {
      // console.log("parseError");
      // console.log(err.messsage);
    };
    // console.log("Rendering");
    // console.log(input);
    // mermaidAPI.render(title, "graph TB;Loading;", diagram => {
    //   console.log("Rendered");
    //   setTimeout(
    //     () =>
    //       mermaidAPI.render(title, input, diagram => {
    //         console.log("Rendered");
    //         console.log(diagram);
github timberio / gitdocs / src / components / Markdown / Mermaid.js View on Github external
componentDidMount () {
    const { children, config, height, width } = this.props
    const defaultConfig = {
      // If this is true, mermaid tries to re-render
      // using window.addEventListener('loaded', ...)
      // which screws it all up.
      startOnLoad: false,
      gantt: {
        useWidth: width,
        useHeight: height || null,
      },
    }
    const mermaidConfig = merge(defaultConfig, config)
    mermaidAPI.initialize(mermaidConfig)

    const doc = children.toString().trim()
    const diagram = mermaidAPI.render(doc)
    this.setState({
      diagram,
    })
  }
github inkdropapp / inkdrop-mermaid / src / index.js View on Github external
activate() {
    mermaidAPI.initialize({
      startOnLoad: false,
      theme: inkdrop.config.get('mermaid.theme')
    })

    if (markdownRenderer) {
      markdownRenderer.remarkCodeComponents.mermaid = Mermaid
    }
  },
github lxerxa / actionview-fe / app / components / workflow / PreviewModal.jsx View on Github external
constructor(props) {
    super(props);
    mermaidAPI.initialize({
      startOnLoad:false
    });
  }