Remarkable plugin to render spoiler block
npm install @quochuync/remarkable-spoiler
import RemarkableSpoiler from '@quochuync/remarkable-spoiler';
import '@quochuync/remarkable-spoiler/styles.css';const md = new Remarkable();
md.use(RemarkableSpoiler);
`Markdown
$3
The plugin will convert blockquote markdown with specified prefix into a and block:
`
>! This is a spoiler content.
> This is a second line
`$3
`
>! [Click to reveal] This is a spoiler content.
> This is a second line
`Options
$3
By default the prefix is '!' (exclamation mark), to change the prefix:
`
md.use(RemarkableSpoiler, { prefix: '@' });
`$3
If the user does not provide the reveal text, it will defaul to "Reveal spoiler". to change this default value:
`
md.use(RemarkableSpoiler, { defaultRevealText: 'Reveal content' });
``To change this:
md.use(RemarkableSpoiler, { revealTextMaxLength: 100 });