nuxt-alt / markdown-it

Alternative module to @nuxtjs/markdownit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

markdown-it for Nuxt 3

This is an alternaive module for @nuxtjs/markdownit.

Setup

  1. Add the @nuxt-alt/markdown-it dependency to your project
yarn add @nuxt-alt/markdown-it
  1. Add @nuxt-alt/markdown-it to the modules section of nuxt.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 }]
        ]
    }
});

Usage

Using $md to render markdown

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>

About

Alternative module to @nuxtjs/markdownit

License:MIT License


Languages

Language:TypeScript 90.1%Language:JavaScript 8.6%Language:Vue 1.3%