Vue Markdown Renderer

2.3.0 · active · verified Tue Apr 21

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.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates basic usage of the VueMarkdown component, including passing markdown source, markdown-it options, and external markdown-it plugins.

import { defineComponent, ref } from 'vue';
import VueMarkdown from 'vue-markdown-render';
import MarkdownItAnchor from 'markdown-it-anchor';

export default defineComponent({
  name: 'MarkdownViewer',
  components: {
    VueMarkdown
  },
  setup() {
    const src = ref('# Hello, VueMarkdown\n\nThis is some **dynamic** content rendered from Markdown.\n\n## Features\n\n-   Lightweight
-   TypeScript support
-   Plugin ready (e.g., markdown-it-anchor)

[Link to GitHub](https://github.com/cloudacy/vue-markdown-render)');

    const options = {
      html: true,
      linkify: true,
      typographer: true
    };

    const plugins = [MarkdownItAnchor];

    return {
      src,
      options,
      plugins
    };
  },
  template: `
    <div>
      <VueMarkdown :source="src" :options="options" :plugins="plugins" />
    </div>
  `
});

view raw JSON →