3.0.0 • Published 7 years ago

remark-bracketed-spans v3.0.0

Weekly downloads
153
License
ISC
Repository
github
Last release
7 years ago

remark-bracketed-spans

Add an id, classes, and data attributes to <span> tags in markdown.

npm travis standard conduct

About

A remark plugin for adding attributes to span tags in markdown that works even when the span is nested inside other markdown elements.

Usage looks like this:

[text in the span]{.class .other-class key=val another=example}

And results in HTML like this:

<p><span class="class other-class" data-key="val" data-another="example">text in the span</span></p>

Install

npm install --save remark-bracketed-spans

Usage

This module is a remark plugin, and can be used like this:

var remark = require('remark')
var toHTML = require('remark-html')
var bracketedSpans = require('remark-bracketed-spans')

var md = '[text in the span]{.class .other-class key=val another=example}'

var html = remark().use(bracketedSpans).use(toHTML).processSync(md).toString()

console.log(html)

License

ISC