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

vue-simple-md-editor

v1.2.0

Published

A simple markdown editor for vue

Downloads

10

Readme

Vue markdown editor

This is a basic markdown editor made for Vue, based on Bootstrap and Font Awesome.

Example

You can find a example on Codesandbox or on GitHub

Pre requirements

  • Install Font Awesome for the toolbar icons.
  • If you want you can install Bootstrap or do the styling by yourself.

Installation

First install this package via npm or yarn:

npm i vue-simple-md-editor or yarn install vue-simple-md-editor

And then simply add in your Vue setup script:

import mdEditor from 'vue-md-editor';
import Vue from 'vue';

Vue.use(mdEditor);

Usage and examples

Now you can use the markdown editor in your Vue container or components. You can use it with or without v-model.

Basic usage

<template>
    <div class="container">
        <md-editor v-model="value"></md-editor>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                value: '#Hello world!'
            }
        }
    }
</script>

Custom toolbar button(s)

There is also the option to add your own toolbar buttons via the prop custombuttons as an array of button objects. Each button has the following properties:

| Property | Default | Description| |----------|---------|------------| |label | null | The name of the button| |key | null | This is used in the event | |icon | null | Which Font Awesome icon | |group | custom | In which group should the button be (basic, advanced, custom or other ) |

When the button is clicked, an event is fired prefixed with insert: and after that the key. At this moment you can use 3 functions in your event callback. You can find an example here below.

| Function | Params | |----------|--------| | insertBlock | start, end (default: start) | | insertImage | altText, src | | insertLink | title, link |

<template>
    <div class="container">
        <md-editor ref="editor" v-model="value" :custombuttons="buttons"></md-editor>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                value: '#Hello world!',
                buttons: [
                        {
                            label: 'Insert a cat',
                            key: 'cat',
                            icon: 'fas fa-cat',
                            group: 'advanced'
                        }
                    ]
            }
        },
        mounted() {
          this.$refs.editor.$on('insert:cat', (editor) => {
              editor.insertImage('Cat image', 'http://placekitten.com/100/100');
          });
        }
    }
</script>

All available Props

| Prop | Default | Description | |------|---------|-------------| | custombuttons | [] | An array with objects to add custom button(s) to the toolbar. See example above. | | disabledbuttons | [] | An array of button keys of which button need to be removed from the toolbar. |

Styling

The styling of this plugin is based on Bootstrap and the icons are from Font Awesome. But this plugin also uses custom classes so you can easily change the styling. All custom classes are prefixed with .md-editor-*. Below you will find an overview of all classes.

| Class | Description | |------------------------|-----------------------------------------------------------------------------------| |.md-editor-container| The container surrounding the whole editor. | |.md-editor-toolbar | Toolbar containing all buttons. | |.md-editor-editor | The editor area itself. | |.md-editor-preview | When you click on preview button this area shows up containing a rendered preview.|

Requested features

The requested features below will be implemented soon.

  • Rearrange toolbar
  • Support for keyboard shortcuts
  • Inline syntax highlighting
  • Side by side (editor and preview)
  • Autosave feature

Do you have a feature request? Let us know via an issue