npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@adapttive/vue-markdown

v4.0.2

Published

A Powerful and High speed Markdown Parser for Vue

Downloads

7,703

Readme

vue-markdown

npm npm npm npm npm

If you want vue-markdown for vue1.X.X, please checkout vue-markdown1.X.X.

A Powerful and Highspeed Markdown Parser for Vue.

Quick start: <vue-markdown>i am a ~~tast~~ **test**.</vue-markdown>

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] emoji
  • [x] mark
  • [x] *katex

*SyntaxHighlighter work with Prism recommend

*katex need add katex css.

Example

simple

webpack-simple

Live Demo

Installation

Browser globals

The dist folder contains vue-markdown.js with the component exported in the window.VueMarkdown object.

<body>
  <vue-markdown>i am a ~~tast~~ **test**.</vue-markdown>
</body>
<script src="path/to/vue.js"></script>
<script src="path/to/vue-markdown.js"></script>
<script>
    Vue.use(VueMarkdown);
    var vm = new Vue({
        el: "body"
    });
</script>

NPM

$ npm install --save @adapttive/vue-markdown

Yarn

$ yarn add @adapttive/vue-markdown --save

Migrating from vue-markdown 2.3

  • You just need to replace the dependencies in package.json:
{
  "dependencies": {
-  "vue-markdown": "^2.2.4
+  "vue-markdown": "npm:@adapttive/vue-markdown@^X.X.X"
  }
}

CommonJS

var VueMarkdown = require('@adapttive/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.

import VueMarkdown from '@adapttive/vue-markdown'

new Vue({
  components: {
    VueMarkdown
  }
})

Slots

<vue-markdown>this is the default slot</vue-markdown>

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 | <br></br> => <br /> | | breaks | Boolean | true | \n => <br> | | linkify | Boolean | true | autoconvert URL-like text to link | | emoji | Boolean | true | :) => 😃 | | typographer | Boolean | true | enable some language-neutral replacement and quotes beautification | | update-prism | Boolean | true | if true, vue-markdown will automatically call a re-render of all code blocks through Prism.js (Using Prism.js) | | 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 <table> | | task-lists | Boolean | true | Makes GFM task lists mutable, false shows GFM as readonly checkboxes | | 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 <ul> wrapping the TOC | | toc-first-level | Number | 2 | use 2 if you want to skip <h1> from the TOC | | toc-last-level | Number | 'toc-first-level' + 1 | use 5 if you want to skip <h6> from the TOC | | toc-anchor-link | Boolean | true | enable the automatic anchor link in the headings | | toc-anchor-class | String | toc-anchor | customize the anchor class name | | toc-anchor-link-symbol | String | # | customize the anchor link symbol | | toc-anchor-link-space | Boolean | true | enable inserting a space between the anchor link and heading | | toc-anchor-link-class | String | toc-anchor-link | customize the anchor link symbol class name | | toc-anchor-link-before | Boolean | true | allows you to prepend/append the anchor link in the headings | | anchorAttributes | Object | {} | anchor tag attributes such as target: '_blank' or rel: 'nofollow' | | prerender | Function (String) String | null | filter function before markdown parse | | postrender | Function (String) String | null | filter function after markdown parse | | inline | Boolean | false | result will NOT be wrapped into <p> tags |

Events

| Name | Param[Type] | Describe | | ---- | --------- | -------- | | rendered | outHtml[String] | dispatch when render finish | | toc-rendered | tocHtml[String] | dispatch when TOC render finish, never dispatch if the toc[prop] is false |

Using Prism.js

  1. Visit the download page
  2. Select all the options that apply for your project
  3. At the bottom of the page download both the JS and CSS
  4. Include them in your index.html MAKE SURE to include Prism before your app.js

Plugins

 <template>
   <div>
     <vue3-markdown-it :source='source' :plugins='plugins' />
   </div>
 </template>

 <script>
 import katex from 'markdown-it-katex';
 import tasklists from 'markdown-it-task-lists';
 import externalPreview from 'markdown-it-external-preview';
 import VueMarkdown from 'vue-markdown';

 export default {
   components: {
     VueMarkdown
   },
   data() {
     return {
       plugins: [
         {
           plugin: katex,
           options: { throwOnError: false, errorColor: ' #cc0000' }
         },
         {
           plugin: tasklists,
           options: { enabled: this.taskLists }
         },
         {
           plugin: externalPreview
         }
       ]
     }
   }
 }
 </script>
  • Make sure you add dependencies for plugins:
    • "highlight.js": "^10.4.0"
    • "markdown-it-external-preview": "^1.0.4"
    • "markdown-it-katex": "npm:@iktakahiro/markdown-it-katex@^4.0.1"

Thanks

Contributions

License

Copyright (c) 2016