How to use Markdown content in Nuxt 2 and Typescript

Nuxt guide logo

Markdown in Nuxt

Installing dependencies

Install Nuxt's Markdown module.

Install Markdown attrs dependency.

Install Markdown div dependency.

Add Markdown types in tsconfig.json

                                
                                        // tsconfig.json
"types": [
  "@nuxtjs/markdownit"
]
                                    
                            

Render content in the template:

                                <!-- content is where your content that needs to be render -->
<div v-html="$md.render(content)"></div>
                            
Previous post How to add CSS class dynamically on the HTML body in Nuxt
Next post How to create 404 missing page in Nuxt using Composition API