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.

Docs theme with additional Plugins | Adding MermaidJs to NuxtJs [Solved]

See original GitHub issue

Hello, i want to implement a vue-mermaid plugin inside my nuxt-docs app. Since the nuxt.config.js got exported I cant import plugins like

import theme from '@nuxt/content-theme-docs'

export default theme({
  plugins: [
        // https://yarnpkg.com/package/vue-mermaid#readme
        '~/plugins/vue-mermaid.js'
  ],
})

The App tries then to open a plugin folder relative to the node_modules nuxt-docs-theme package…

Plugin not found: myApp\node_modules@nuxt\content-theme-docs\plugins\vue-mermaid.js

How to implement Plugins with this new architecture?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
derHodrigcommented, Feb 9, 2021

I got it to work. Firstly we need MermaidJs npm i mermaid or yarn add mermaid

Secondly create a new Component in components>global

mermaid.vue

<template>
  <div class="mermaid">
    <slot></slot>
  </div>
</template>

<script>
export default {
  mounted() {
    import("mermaid/dist/mermaid").then(m => {
      m.initialize({
        startOnLoad: true
      });
      m.init();
    });
  }
};
</script>

After that you can use it in your markdown

<mermaid>
graph TD
  A[Silvester] -->|Get money| B(Go shopping)
  B --> C{Let me think}
  C -->|One| D[Laptop]
  C -->|Two| E[iPhone]
  C -->|Three| F[Car]
  C -->|Four| F[Mac]
</mermaid>

hint: between those <mermaid> tags should no empty lines!

In the end, it look like this

own mermaid


No plugin or nuxt.config.js configuration needed

1reaction
Atinuxcommented, Feb 9, 2021

Awesome! I will see to implement it into Docus 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding additional Plugins to Docs Theme in Nuxt (forked)
TemplateAdding additional Plugins to Docs Tjeme in Nuxt; Environmentnuxt. Files. content. plugins. static .editorconfig .gitignore. README.md.
Read more >
Mermaid JS Plugin - Discourse Meta
See the Mermaid JS site for documentation and more examples. ... requires you to add Mermaid JS to the <head> section of your...
Read more >
How to create a global custom plugin in Nuxt.js
Cover two different options for building a custom global plugin for a Nuxt.js app, using both Vue and JavaScript.
Read more >
Add Support for Rendering of Mermaid.js in Markdown Preview
Rest of my team uses VSCode and mermaid diagrams within markdown documents and I always had to copy them to a scratch file...
Read more >
Release Notes - FastAPI
Add Portuguese translation for docs/pt/docs/deployment/docker.md . ... mkdocs for languages as a subprocess to fix/enable MkDocs Material search plugin.
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