1. markdown-it-regex
Plugin for markdown-it, replaces strings that match a regular expression pattern.
markdown-it-regex
Package: markdown-it-regex
Created by: tylingsoft
Last modified: Sun, 19 Jun 2022 16:09:15 GMT
Version: 0.2.0
License: MIT
Downloads: 6,545
Repository: https://github.com/tylingsoft/markdown-it-regex

Install

npm install markdown-it-regex
yarn add markdown-it-regex

markdown-it-regex

Plugin for markdown-it, replaces strings that match a regular expression pattern.

Installation

yarn add markdown-it-regex

Usage

 import markdownIt from 'markdown-it'
import markdownItRegex from 'markdown-it-regex'
const mdi = markdownIt()
mdi.use(markdownItRegex, {
  name: 'emoji',
  regex: /(:(?:heart|panda_face|car):)/,
  replace: (match) => {
    return `<i class="e1a-${match.slice(1, -1)}"></i>`
  }
})
mdi.render('I :heart: you') // <p>I <i class="e1a-heart"></i> you</p>

Development

Build

yarn build:watch

Test

yarn test

Distribution

yarn release && npm publish

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin