markdown-it-vue icon indicating copy to clipboard operation
markdown-it-vue copied to clipboard

Using markdown-it-vue with nuxtjs

Open ewen-lbh opened this issue 4 years ago • 5 comments

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

ewen-lbh avatar Aug 17 '19 14:08 ewen-lbh

I know this isn't really an issue but @ravenq you might wanna consider supporting nuxt out-of-the-box

ewen-lbh avatar Aug 17 '19 14:08 ewen-lbh

@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 avatar Aug 19 '19 08:08 ravenq

@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

drimacus182 avatar May 27 '21 17:05 drimacus182

@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

ImSeaWorld avatar Jul 23 '21 22:07 ImSeaWorld