Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using markdown-it-vue with nuxtjs #8

Open
ewen-lbh opened this issue Aug 17, 2019 · 4 comments
Open

Using markdown-it-vue with nuxtjs #8

ewen-lbh opened this issue Aug 17, 2019 · 4 comments

Comments

@ewen-lbh
Copy link

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
Copy link
Author

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

@ravenq
Copy link
Owner

ravenq commented Aug 19, 2019

@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.

@drimacus182
Copy link

@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

@ImSeaWorld
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants