markdown-it-vue
markdown-it-vue copied to clipboard
Using markdown-it-vue with nuxtjs
If you are having trouble with a "window
is undefined"–type of error while trying to use it with a universal (SSR, Server-side rendered) app, you might want to follow this guide: https://medium.com/@codebeast_/why-your-third-party-plugin-dont-work-in-nuxt-and-how-to-fix-it-d1a8caadf422
It worked like a charm for me
I know this isn't really an issue but @ravenq you might wanna consider supporting nuxt out-of-the-box
@ewen-lbh Thanks for you issue!
This package do not supports for SSR yet, because the plugins of charts (echarts, flowchart, memaid.js) do not surpport for SSR.
you can close the ssr option in the nuxt.config.js:
plugins: [
{ src: '@/plugins/markdown-it-vue', ssr: false }
],
and make a file in plugins folder, 'markdown-it-vue.js'
import Vue from 'vue'
import MarkdownItVue from 'markdown-it-vue'
import 'markdown-it-vue/dist/markdown-it-vue.css'
Vue.use(MarkdownItVue)
I will try to make it supports for SSR if it can be.
@ravenq Is it possible to create a separate build without all the chart plugins, to use it with nuxt ssr? The same principle as markdown-it-light
, I mean.
Personally, I don't need the chart functionality at all, however, it's critical for me to be able to render it with Nuxt SSR
@ravenq Is it possible to create a separate build without all the chart plugins, to use it with nuxt ssr? The same principle as
markdown-it-light
, I mean.Personally, I don't need the chart functionality at all, however, it's critical for me to be able to render it with Nuxt SSR
Have you tried the Nuxt community module? https://www.npmjs.com/package/@nuxtjs/markdownit