This is an alternaive module for @nuxtjs/markdownit.
- Add the
@nuxt-alt/markdown-itdependency to your project
yarn add @nuxt-alt/markdown-it- Add
@nuxt-alt/markdown-itto themodulessection ofnuxt.config.ts
export default defineNuxtConfig({
modules: [
'@nuxt-alt/markdown-it'
],
// [optional] markdownit options
// See https://github.com/markdown-it/markdown-it
markdownit: {
preset: 'default',
linkify: true,
breaks: true,
use: [
'markdown-it-div',
['markdown-it-attrs', { ...options }]
]
}
});nuxt.config.ts:
export default defineNuxtConfig({
modules: [
'@nuxt-alt/markdown-it'
],
markdownit: {
runtime: true
}
});hello.vue:
<template>
<div v-html="$md.render(model)"></div>
</template>
<script lang="ts" setup>
const model = '# Hello World!'
</script>