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-simplemde-shine-ren

v0.4.4

Published

SimpleMDE - Markdown Editor component for Vue.js

Downloads

3

Readme

Vue-SimpleMDE

Markdown Editor component for Vue.js. Support both vue1.0 & vue2.0.

NPM

Demo

Demo Page

Use Setup

Install vue-simplemde

npm install vue-simplemde --save

Use

// import with ES6
import Vue from 'vue'
import VueSimplemde from 'vue-simplemde'

// require with Webpack/Node.js
var Vue = require('vue')
var VueSimplemde = require('vue-simplemde')

// use
Vue.use(VueSimplemde)
// or use with component(ES6)
import { markdownEditor } from 'vue-simplemde'

export default {
  components: {
    markdownEditor
  }
}

Examples

Vue1.0

<!-- 使用双向绑定修饰符 -->
<markdown-editor :value.sync="content" v-ref:markdown-editor></markdown-editor>

Vue2.0

<!-- 通过 v-model 控制 value -->
<markdown-editor v-model="content" ref="markdownEditor"></markdown-editor>

<!-- 通过事件控制 value -->
<markdown-editor :value="content" @input="handleInput"></markdown-editor>

<!-- 添加配置 -->
<markdown-editor :configs="configs"></markdown-editor>

Both

import { markdownEditor } from 'vue-simplemde'

// 基础用法
export default {
  components: {
    markdownEditor
  },
  data () {
    return {
      content: '',
      configs: {
        spellChecker: false // 禁用拼写检查
      }
    }
  }
}

// 添加更多配置,获取编辑器对象,添加事件绑定,判断编辑器状态
export default {
  components: {
    markdownEditor
  },
  data () {
    return {
      content: '',
      configs: {
        status: false, // 禁用底部状态栏
        initialValue: 'hellow', // 设置初始值
        renderingConfig: {
          codeSyntaxHighlighting: true, // 开启代码高亮
          highlightingTheme: 'atom-one-light' // 自定义代码高亮主题,可选列表(https://github.com/isagalaev/highlight.js/tree/master/src/styles)
        }
      }
    }
  },
  computed: {
    simplemde () {
      return this.$refs.markdownEditor.simplemde
    }
  },
  mounted: {
    console.log(this.simplemde)
    this.simplemde.togglePreview()

    // 'change'事件已经绑定,可以通过@input指定处理器
    // 如果需要,你可以自行绑定这个列表中的其他事件: https://codemirror.net/doc/manual.html#events
    this.simplemde.codemirror.on('beforeChange', (instance, changeObj) => {
      // do some things
    })

    // 移除SimpleMDE,组件销毁时会自动调用
    this.simplemde = null

    // 一些有用的方法
    this.simplemde.toTextArea()
    this.simplemde.isPreviewActive() // returns boolean
    this.simplemde.isSideBySideActive() // returns boolean
    this.simplemde.isFullscreenActive() // returns boolean
    this.simplemde.clearAutosavedValue() // no returned value
    this.simplemde.markdown(this.content) // returns parsed html
  },
  methods: {
    handleInput () {
      // do some things
    }
  }
}

Editor Theme (simplemde-theme-base)

e.g. 使用simplemde-theme-base主题

install

$ npm install --save simplemde-theme-base

use

<markdown-editor :custom-theme="true"></markdown-editor>
import 'simplemde-theme-base/dist/simplemde-theme-base.min.css'

Markdown style

e.g. 使用Github的markdown样式

github-markdown-css

install

$ npm install --save github-markdown-css

use

<markdown-editor preview-class="markdown-body"></markdown-editor>
// 使用默认编辑器主题时
require.ensure([], () => require('github-markdown-css'), 'markdown-style')

// 使用自定义编辑器主题时
import 'github-markdown-css'

Configuration

Dependencies

Licence

vue-simplemde is open source and released under the MIT Licence.

Copyright (c) 2017 F-loat