Thanks to benrbray/remark-cite for a
remark
plugin boilerplate.
A micromark
syntax extension for Discord-style spoilers, providing the low-level modules for integrating with the micromark tokenizer and the micromark HTML compiler.
You probably shouldn’t use this package directly, but instead use mdast-util-inline-spoiler
with mdast or remark-inline-spoiler
with remark.
Install micromark-extension-inline-spoiler
on npm
, yarn
or bun
.
npm install micromark-extension-inline-spoiler
yarn add micromark-extension-inline-spoiler
bun install micromark-extension-inline-spoiler
import micromark from "micromark";
import { spoilerSyntax, spoilerHtml } from "micromark-extension-inline-spoiler";
let serialized = micromark('||Don\'t spoil this||', {
extensions: [spoilerSyntax()],
htmlExtensions: [spoilerHtml()]
});
The serialized result will be the following. To get an abstract syntax tree, use mdast-util-inline-spoiler
instead.
<p><span class="spoiler">Don't spoil this</span></p>