Skip to content

Mermaid graphs on multiple pages only render on first synchronous load  #504

Closed
@jfmou

Description

@jfmou

Hi all,

Thanks a lot for the awesome work done on docsify, love it !
I'm having troubles with 2 mermaid graphs on two separate pages.
When I access each of these pages synchronously, each graph renders correctly.
But when I try to navigate from one page to the other, the second one asynchronously loaded doesn't have any graph rendered.
On click, it does go through the following snippet :

<script>
  mermaid.initialize({ startOnLoad: false });
  window.$docsify = {
    name: 'COP Front',
    coverpage: true,
    loadSidebar: true,
    subMaxLevel: 3,
    auto2top: true,
    themeColor: '#4e93a5',
    markdown: {
      renderer: {
        code: function(code, lang) {
          if (lang === "mermaid") {
            return (
              '<div class="mermaid">' + mermaid.render(lang, code) + "</div>"
            );
          }
          return this.origin.code.apply(this, arguments);
        }
      }
    }
  }
</script>

Mermaid seems to generate the proper svg graph based on raw text.
But when the destination page is rendered it looks like it didn't replace raw text by svg graph in place resulting in the page rendered without any graph.
I guess i'm missing something, thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions