Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

markdown-it-link-attributes

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-it-link-attributes

A markdown-it plugin to configure the attributes for links

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
41K
increased by19.33%
Maintainers
1
Weekly downloads
 
Created
Source

Link attributes plugin for markdown-it markdown parser.

Install

node.js, browser:

npm install markdown-it-link-attributes --save
bower install markdown-it-link-attributes --save

Use

var md = require('markdown-it')()
var mila = require('markdown-it-link-attributes')
md.use(mila, {
  target: '_blank',
  rel: 'noopener'
})

var html = md.render('[link](https://google.com)')
html // <p><a href="https://google.com" target="_blank" rel="noopener">link</a></p>

If the linkify optoon is set to true on markdown-it, then the attributes will be applied to plain links as well.

var md = require('markdown-it')({
  linkify: true
})

md.use(mila, {
  target: '_blank',
  rel: 'noopener'
})

var html = md.render('foo https://google.com bar')
html // <p>foo <a href="https://google.com" target="_blank" rel="noopener">https://google.com</a> bar</p>

Differences in browser. If you load script directly into the page, without a package system, the module will add itself globally as window.markdownitLinkAttributes.

License

MIT

Keywords

FAQs

Package last updated on 26 Aug 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc