eosnetworkfoundation / docsgen

Scripts for creating docs.eosnetwork.com pulls from various eos nf repos and builds static HTML to power website
Other
3 stars 0 forks source link

Add Mermaid support for graphs #24

Open ericpassmore opened 2 years ago

ericpassmore commented 2 years ago

Feature request now that mermaid is an official part of github https://github.com/facebook/docusaurus/issues/1258

ericpassmore commented 2 years ago

look into https://github.com/sjwall/mdx-mermaid

lparisc commented 2 years ago

Current workaround for docusaurus v2: https://github.com/facebook/docusaurus/issues/1258#issuecomment-594393744

ericpassmore commented 2 years ago

Current workaround for docusaurus v2: facebook/docusaurus#1258 (comment)

Suggest we try the plugin first (sjwall/mdx-mermaid). It is a cleaner implementation and it is a supported project.

ericpassmore commented 2 years ago

Summary of implementation steps

async function createConfig() {
  const mdxMermaid = await import('mdx-mermaid')

  return {
    presets: [
      [
        'classic',
        {
          docs: {
            remarkPlugins: [mdxMermaid.default],
          }
        }
      ]
    ]
  }
}

module.exports = createConfig;

Now mermaid graphs will render in doc6s.

ericpassmore commented 2 years ago

Gave this another try, ran into issues with Redocusaurus. Opened tracking issue rohit-gohri/redocusaurus/issues/244

ericpassmore commented 1 year ago

Looks like there is a theme now for mermaid support https://docusaurus.io/docs/next/api/themes/@docusaurus/theme-mermaid