Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hojas/vue-markdown-viewer

πŸ‡² Markdown component for Vue 3. η”¨δΊŽζΈ²ζŸ“ Markdown ηš„ Vue 3 组仢。
https://github.com/hojas/vue-markdown-viewer

markdown remark vue

Last synced: 28 days ago
JSON representation

πŸ‡² Markdown component for Vue 3. η”¨δΊŽζΈ²ζŸ“ Markdown ηš„ Vue 3 组仢。

Awesome Lists containing this project

README

        

# vue-markdown-viewer

![npm](https://img.shields.io/npm/v/vue-markdown-viewer)
![npm](https://img.shields.io/npm/dm/vue-markdown-viewer)

Vue component to render markdown with [remark](https://github.com/remarkjs/remark).

## Install

```shell
$ npm install vue-markdown-viewer
```

## Use

```vue

import { ref } from 'vue'
import { VueMarkdownRender } from 'vue-markdown-viewer'

const md = ref('## hi')

{{ md }}

```

Use a plugin to support gfm:

```vue

import { ref } from 'vue'
import { VueMarkdownRender } from 'vue-markdown-viewer'
import remarkGfm from 'remark-gfm'

const md = ref('## hi')


{{ md }}

```

Use a plugin to support syntax highlight:

````vue

import { ref } from 'vue'
import { VueMarkdownRender } from 'vue-markdown-viewer'
import rehypeHighlight from 'rehype-highlight'

const md = ref(`
## Highlight

```js
console.log("hi")
```
`)


{{ md }}

````

## Options

- `content`: `string` \
markdown string
- `components`: `Record` \
object mapping tag names to Vue components
- `remarkRehypeOptions`: `Record` \
Options of remark-rehype
- `remarkPlugins`: `Array` \
list of remark plugins to use
- `rehypePlugins`: `Array` \
list of rehype plugins to use
- `className`: `string` \
wrap the markdown in a `div` with this class name
- `skipHtml`: `boolean`, default: `false` \
ignore HTML in markdown completely
- `linkTarget`: `string` \
target to use on links

## Related

- [react-markdown](https://github.com/remarkjs/react-markdown)