# vue-markdown [![npm](https://img.shields.io/npm/v/vue-markdown.svg?style=flat)](https://www.npmjs.com/package/vue-markdown) [![npm](https://img.shields.io/npm/l/vue-markdown.svg?style=flat)](https://www.npmjs.com/package/vue-markdown) [![npm](https://img.shields.io/npm/dt/vue-markdown.svg?style=flat)](https://www.npmjs.com/package/vue-markdown) > If you want vue-markdown for `vue1.X.X`, please checkout [vue-markdown1.X.X](https://github.com/miaolz123/vue-markdown/tree/v1). A Powerful and Highspeed Markdown Parser for Vue. Quick start: `i am a ~~tast~~ **test**.` Supported Markdown Syntax: * [x] automatic table of contents * [x] table & class customize * [x] *SyntaxHighlighter * [x] definition list * [x] strikethrough * [x] GFM task list * [x] abbreviation * [x] superscript * [x] subscript * [x] footnote * [x] insert * [x] *katex * [x] emoji * [x] mark `*SyntaxHighlighter` work with [Prism](http://prismjs.com) recommend `*katex` need add [katex css](https://unpkg.com/katex/dist/katex.min.css). # Example [simple](https://github.com/miaolz123/vue-markdown/blob/master/example/simple) [webpack-simple](https://github.com/miaolz123/vue-markdown/blob/master/example/webpack-simple) [Live Demo](http://miaolz123.github.io/vue-markdown/) # Installation ### Browser globals > The **dist** folder contains `vue-markdown.js` with the component exported in the `window.VueMarkdown` object. ```html i am a ~~tast~~ **test**. ``` ### NPM ```shell $ npm install --save vue-markdown ``` ### Yarn ```shell $ yarn add vue-markdown --save ``` ## CommonJS ```js var VueMarkdown = require('vue-markdown'); new Vue({ components: { 'vue-markdown': VueMarkdown } }) ``` ## ES6 (Vue-CLI users) After installing via Yarn or NPM, use the following snippet in the script portion of the Vue component which you wish to render the Markdown. ```js import VueMarkdown from 'vue-markdown' new Vue({ components: { VueMarkdown } }) ``` # Slots ```html this is the default slot ``` After setting up the middleware in your vue component above, using the embedded markdown is as easy as writing it between the `vue-markdown` tags. VueMarkdown has a default slot which is used to write the `markdown` source. TIP: The default slot only renders **once** at the beginning, and it will overwrite the prop of `source`! # Props | Prop | Type | Default | Describe | | ---- | ---- | ------- | ------- | | watches | Array | `["source", "show", "toc"]` | HTML refresh automatically when the prop in this array changed | | source | String | `null` | the markdown source code | | show | Boolean | `true` | enable render to the default slot automatically | | html | Boolean | `true` | enable HTML syntax in source | | xhtml-out | Boolean | `true` | `

` => `
` | | breaks | Boolean | `true` | `\n` => `
` | | linkify | Boolean | `true` | autoconvert URL-like text to link | | emoji | Boolean | `true` | `:)` => `๐Ÿ˜ƒ` | | typographer | Boolean | `true` | enable some language-neutral replacement and quotes beautification | | lang-prefix | String | `language-` | CSS language prefix for fenced blocks | | quotes | String | `โ€œโ€โ€˜โ€™` | use `โ€œโ€โ€˜โ€™` for Chinese, `โ€žโ€œโ€šโ€˜` for German, `ยซยปโ€žโ€œ` for Russian | | table-class | String | `table` | customize html class of the `` | | task-lists | Boolean | `true` | enable GFM task list | | toc | Boolean | `false` | enable automatic table of contents | | toc-id | String | `undefined` | the HTML id to render TOC | | toc-class | String | `table` | customize html class of the `