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

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code