vue-markdown-render is a lightweight and simple wrapper for the popular markdown-it parsing library, specifically designed for Vue 3 applications. It provides a `VueMarkdown` component that allows rendering Markdown source into HTML directly within Vue templates. The package is written in pure TypeScript, offering full type support. The current stable version is 2.3.0, released in late 2023, indicating an active maintenance and development cadence with regular updates for dependencies like markdown-it. Key differentiators include its minimalistic API, full TypeScript integration, and direct support for passing markdown-it options and plugins, making it flexible for various rendering needs without significant overhead. It requires Vue 3.x as a peer dependency.
npm install vue-markdown-renderVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of the VueMarkdown component, including passing markdown source, markdown-it options, and external markdown-it plugins.
Upgrade your Vue application to Vue 3 or use `vue-markdown-render@1.x` for Vue 2 compatibility.
Add `"@types/markdown-it": "*"` to your devDependencies in `package.json` and run `npm install`.
Test your markdown rendering thoroughly after upgrading to v2.3.0, especially if you use custom markdown-it configurations or plugins that might be sensitive to markdown-it version changes.
Consider migrating component usage to Composition API with `<script setup>` for new components or refactoring existing ones for improved maintainability and performance, although the Options API remains functional.
Ensure your project is using Vue 3.x. If you must use Vue 2, downgrade `vue-markdown-render` to a 1.x version.
Install `@types/markdown-it` as a dev dependency: `npm install @types/markdown-it --save-dev`.
Add `VueMarkdown` to the `components` object within your Vue component definition, e.g., `components: { VueMarkdown }`.