Add an id, classes, and data attributes to <span>
tags in markdown.
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>
npm install --save remark-bracketed-spans
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)