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

@earthtone/vue-markdown-lite

v0.2.3

Published

Light weight Markdownit Wrapper Vue Component

Downloads

598

Readme

Vue Markdown Lite

Travis CI Status

A Lightweight markdown-it wrapper for Vue, inspired by vue-markdown.

Installation

NPM

$ npm install --save @earthtone/vue-markdown-lite

Globally Registered Component

import VueMarkdownLite from '@earthtone/vue-markdown-lite'
import App from './App.vue'

Vue.use(VueMarkdwonLite)

new Vue({
  el: '#app',
  render: h => h(App)
})

Both ESModules and CommonJS syntax are supported for importing.

CommonJS

const VueMarkdownLite = require('@earthtone/vue-markdown-lite')

ESModule

import VueMarkdownLite from '@earthtone/vue-markdown-lite'

Browser globals

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

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

Single File Component

Single File Components (SFCs) are also importable for use in individual components as described in this guide.

<template>
  <vue-markdown-lite>
    # Hey You Guys!
  </vue-markdown-lite>
</template>

<script>
  import VueMarkdownLite from '@earthtone/vue-markdown-lite/sfc'
  export default {
    components: {
      VueMarkdownLite
    }
  }
</script>

Usage

Stick some markdown in the between the opening/closing vue-markdown-lite brackets!

<template>
  <vue-markdown-lite>
# Hello Markdown!

## This is some generic markdown

- this
- is a
- list
- of a
- few
- items

> This is a quotation, which is a noun, but not a quote, which is a verb.

![image alt](/path/to/image.png)

[link text](/path/to/link/url)
  </vue-markdown-lite>
</template>

Slots

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

After setting up the middleware in your vue component above, using the embedded markdown is as easy as writing it between the vue-markdown-lite tags.

VueMarkdownLite has a default slot which is used to write the markdown source. The default slot only renders once at the beginning, and it will overwrite the prop of source!

Read more about Slots in Vue

Plugins

By default, the vue-markdown-lite component implements the most limited use case with no additional feature support. It does support loading optional markdown-it plugins as component props.

The expected prop type is an Array of Arrays, containing a reference to the imported plugin module, and any options or arguments the plugin takes.

<vue-markdown-lite :plugins="mdPlugins">
  # Foo Bar

  ::: warning
  * here be dragons *
  :::
</vue-markdown-lite>
import namedHeaders from 'markdown-it-named-headings'
import customContainers from 'markdown-it-container'

export default {
  name: 'parent-component',
  data () {
    return {
      mdPlugins: [
        [ namedHeaders ],
        [ customContainers, 'warning' ]
      ]
    }
  }
}

The above template and script blocks will yield the following output:

<article>
  <h1 id="foo-bar">Foo Bar</h1>
  <div class="warning">
    <p><em>here be dragons</em></p>
  </div>
</article>