Skip to content

hojas/vue-markdown-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-markdown-viewer

npm npm

Vue component to render markdown with remark.

Install

$ npm install vue-markdown-viewer

Use

<script lang="ts" setup>
import { ref } from 'vue'
import { VueMarkdownRender } from 'core'

const md = ref('## hi')
</script>

<template>
  <VueMarkdownRender>{{ md }}</VueMarkdownRender>
</template>

Use a plugin to support gfm:

<script lang="ts" setup>
import { ref } from 'vue'
import { VueMarkdownRender } from 'core'
import remarkGfm from 'remark-gfm'

const md = ref('## hi')
</script>

<template>
  <VueMarkdownRender :remark-plugins="[remarkGfm]">
    {{ md }}
  </VueMarkdownRender>
</template>

Use a plugin to support syntax highlight:

<script lang="ts" setup>
import { ref } from 'vue'
import { VueMarkdownRender } from 'core'
import rehypeHighlight from 'rehype-highlight'

const md = ref(`
## Highlight

```js
console.log("hi")
```
`)
</script>

<template>
  <VueMarkdownRender :rehype-plugins="[rehypeHighlight]">
    {{ md }}
  </VueMarkdownRender>
</template>

Options

  • content: string
    markdown string
  • components: Record<string, Component>
    object mapping tag names to Vue components
  • remarkRehypeOptions: Record<string, any>
    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

About

🇲 Markdown component for Vue 3.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy