A micromark syntax extension for Pandoc-style bracketed spans.
npm install micromark-extension-bracketed-spansmicromark-extension-bracketed-spansA syntax extension for the micromark markdown parser that provides pandoc-style bracketed spans.
You probably shouldn't use this package directly, but instead use mdast-util-bracketed-spans with mdast or remark-bracketed-spans-2 with remark.
``javascript
import { micromark } from "micromark";
import { bracketedSpanHtml } from "micromark-extension-bracketed-spans";
import { bracketedSpanSyntax } from "micromark-extension-bracketed-spans";
let serialized = micromark('[This is some text]{#id .cls key="value"}', {
extensions: [bracketedSpanSyntax()],
htmlExtensions: [bracketedSpanHtml()]
});
`
The serialized result will be the following. To get an abstract syntax tree, use mdast-util-bracketed-spans instead.
` This is some texthtml`
The parser used for the attributes is the same as used by micromark-extension-directive. This leads to a few edge-cases where this plugin behaves differently from Pandoc.
For instance, the following does not parse using micromark-extension-bracketed-spans:
`md`
[This is some text]{key="value}
Pandoc happily parses this and renders it to
` This is some texthtml`
I believe these small incompatibilities with Pandoc are worth the compatibility with the popular micromark-extension-directive` plugin.