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

@suehok/vuetify-markdown-editor

v3.3.4

Published

A Vue.js Component for editing and previewing markdown.

Downloads

3

Readme

vuetify-markdown-editor

npm version npm downloads GitHub

A Vue.js Component for editing and previewing markdown using Vuetify.js and markdown-it.

Install

npm install vuetify-markdown-editor

Since this component is based on Vuetify, it is required to install and configure Vuetify. For installing Vuetify, please visit https://vuetifyjs.com/en/getting-started/quick-start.

Features

  • TypeScript support
  • Solo and inline mode
  • Editor-only and Editor-Preview mode
  • Code highlighting
  • Emoji picking
  • Math formula (See markdown-it-texmath)
  • Image uploading and previewing (to use uploaded image in markdown, use the filename as the link)
  • Mermaid diagram rendering (use code block with language mermaid)

TODO

  • [x] Fix SSR
  • [x] Allow to change sets of emoji
  • [x] Add typescript support
  • [x] Add copy icon
  • [x] Add viewer mode
  • [ ] Fix large image
  • [ ] Add self-hosted emoji images
  • [ ] Add emoji rendering in rendered text
  • [ ] Add more WYSIWYG functions
  • [ ] Add plantuml support

Usage

This package can be used in Node.js module:

<template>
  <v-app>
    <Editor
      mode="preview"
      ref="editor"
      hint="Hint"
      :outline="false"
      :render-config="renderConfig"
      v-model="text"
    />
  </v-app>
</template>

<script>
import { Editor } from "vuetify-markdown-editor";
import { VApp } from 'vuetify/lib';

export default {
  name: "app",
  components: {
    Editor,
    VApp
  },
  data() {
    return {
      text: "",
      renderConfig: {
        // Mermaid config
        mermaid: {
          theme: "dark"
        }
      }
    };
  },
  mounted() {
    // Access properties or methods using $refs
    // this.$refs.editor.focus();
    // this.$refs.editor.upload();

    // Dark theme
    this.$vuetify.theme.dark = true;
  }
};
</script>

To show the rendered html only, use viewer mode.

To use the markdown-it renderer directly, use createRenderer to create it.

Exported modules

  • Editor: a vue component to edit markdown
  • createRenderer: a function to create a markdown-it render

Props

| Prop | Default | Description | | ------------- | --------------------------------------- | ---------------------------------------------------------------- | | value | '' | String that binds to the textarea | | mode | 'preview' | Possible value 'editor', 'preview' or 'viewer'. When set to 'editor' or 'viewer', only the editor or viewer is displayed, while 'preview' mode displays both. | | renderConfig | undefined | Override default configurations | | outline | false | The border will be outlined instead of card style | | color | undefined | The outline and icon's color | | nativeEmoji | false | Use native emoji instead of pictures | | emoji | true | Enable emoji input | | emojiSet | "apple" | Supported emoji sets: 'apple', 'google', 'twitter', 'facebook' | | image | true | Enable image upload | | fileTarget | '/' | Image upload target uri | | fileFilter | file => file.type.startsWith('image') | Allow only specific files. Return true to allow, false to reject | | baseUrl | '/' | The baseUrl for uploaded images. Must end with a slash (mainly used in viewer mode) |

Other props that are not listed in the above table will be directly passed to v-textarea, which enables you to set the native props in v-textarea.

Default Renderer Configurations

{
  // markdown-it-texmath config
  texmath: undefined,
  // markdown-it-highlightjs config
  hightlightjs: undefined,
  // markdown-it-code-copy config
  codeCopy: {
    buttonClass: 'v-icon theme--dark'
  },
  // The native mermaid config
  mermaid: undefined,
  // Markdown-it config
  markdownIt: undefined
}

Methods

| Method | Description | | -------- | ------------------------------------------- | | upload() | Start or resume uploading all files in list | | pause() | Pause uploading | | resume() | Resume uploading | | focus() | Focus on the editor |

Properties

| Property | Description | | -------- | -------------------------------------------------------------------------------------- | | files | Get all files in list in FlowFile format |

Test

Clone this repository, and then run:

npm install
npm run serve

Then open http://localhost:8080 in browser to test.

Screenshots

Solo mode: <Editor v-model="text" />

Solo

Dark mode: this.$vuetify.theme.dark = true;

Dark

Outline mode: <Editor outline v-model="text" />

Outline

Dependencies

License

MIT License