🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More →
Socket
Book a DemoSign in
Socket

@hackmd/markdown-it-regexp

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hackmd/markdown-it-regexp

plugin that makes regexp replacement simple

latest
Source
npmnpm
Version
0.4.1
Version published
Maintainers
3
Created
Source

markdown-it-regexp

THis is fork version of https://github.com/rlidwka/markdown-it-regexp

Make simple markdown-it plugins easier.

Usage:

var md     = require('markdown-it')
var Plugin = require('markdown-it-regexp')

var plugin = Plugin(
  // regexp to match
  /@(\w+)/,

  // this function will be called when something matches
  function(match, utils) {
    var url = 'http://example.org/u/' + match[1]

    return '<a href="' + utils.escape(url) + '">'
         + utils.escape(match[1])
         + '</a>'
  }
)

md()
  .use(plugin)
  .render("hello @user")

// prints out:
// <p>hello <a href="http://example.org/u/user">user</a></p>

Live demo as jsfiddle.

Fair warning:

  • it could be slower than you expect
  • it is a draft, breaking changes might happen

Keywords

markdown-it-plugin

FAQs

Package last updated on 14 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts