markdown-vue
Render Markdown as Vue JS components
2,333
16
| Install | |
|---|---|
npm install markdown-vue |
|
| Latest Version: | 1.0.3 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Sep 28, 2023 |
| Links: | GitHub · npm |
Maintainer: nomorechokedboy
VueJS version of react-markdown
Vue component to render markdown without using innerHTML
Feature highlights
- Safe by default (no
innerHTMLor XSS attacks) - Extensible (you can pass your own component to use instead of
<h1>for# hi) - Plugins (support remark and rehype plugins)
The implementation is 90% shamelessly copied from https://github.com/remarkjs/react-markdown.
Changes include:
- Replacing
Reactspecific component creation withVueJScomponents - Porting the implementation from
javascriptwithJSDoctypes totypescript - Testing with
Vitestinstead of nodejs built-in test module - Development and preview with
Histoire - Using
Viteinstead ofesbuild
Please check the original repo for in-depth details on how to use.
Installation
npm install markdown-vue # using npm
yarn add markdown-vue # using yarn
pnpm install markdown-vue # using pnpm
Usage
VueJs
<script setup lang="ts">
import VueMarkdown from 'markdown-vue'
</script>
<template>
<VueMarkdown source="# Hello, *world*!" />
</template>
NuxtJS
- Add
markdown-vue/nuxtto themodulessection ofnuxt.config.ts
export default defineNuxtConfig({
modules: ['markdown-vue/nuxt']
})
<!-- VueMarkdown is auto imported -->
<template>
<VueMarkdown source="# Hello, *world*!" />
</template>
Development
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release
Note
Currently, your page will be crash if you use this component in Nuxt project dev mode and I can't figure out why. If you figure out the solution, please feel free to create a PR. I will gladly to merge it.
TODO
- Port unit tests from from original library
- Playground with github page
- Fix
NuxtJsdev error (fixed by @starknt)
Related Packages
remark-generic-extensions
!Extension\[Content\]\(Argument\)\{Properties\} -> :tada: — commonmark generic d...
8,508
25
comark
Comark is an open-source Markdown parser and renderer with components, attribute...
1,526,331
1,067
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.3 | ^3.2.47 | MIT | |
| 1.0.2 | ^3.2.47 | MIT | |
| 1.0.1 | ^3.2.47 | MIT | |
| 1.0.0 | ^3.2.47 | MIT | |
| 0.0.0 | ^3.2.47 | MIT |
Pre-releases (12)
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.3-rc1 | ^3.2.47 | MIT | |
| 1.0.2-rc11 | ^3.2.47 | MIT | |
| 1.0.2-rc10 | ^3.2.47 | MIT | |
| 1.0.2-rc09 | ^3.2.47 | MIT | |
| 1.0.2-rc08 | ^3.2.47 | MIT | |
| 1.0.2-rc07 | ^3.2.47 | MIT | |
| 1.0.2-rc06 | ^3.2.47 | MIT | |
| 1.0.2-rc05 | ^3.2.47 | MIT | |
| 1.0.2-rc04 | ^3.2.47 | MIT | |
| 1.0.2-rc03 | ^3.2.47 | MIT | |
| 1.0.2-rc02 | ^3.2.47 | MIT | |
| 1.0.2-rc01 | ^3.2.47 | MIT |