@mdit/plugin-spoiler
用于隐藏内容的插件。
使用
import { spoiler } from "@mdit/plugin-spoiler";
import MarkdownIt from "markdown-it";
const mdIt = new MarkdownIt().use(spoiler);
mdIt.render("VuePress Theme Hope !!十分强大!!。");在使用默认选项的情况下,你可以导入 @mdit/plugin-spoiler/style 以应用相应样式。
语法
使用 !! !! 进行标记。
选项
tag
string默认值
"span"剧透元素的 HTML 标签名称。
attrs
[attr: string, value: string][] | (() => [attr: string, value: string][])默认值
() => [["class", "spoiler"], ["tabindex","-1"]]剧透元素的自定义 HTML 属性。静态数组会为每个令牌克隆一份;工厂函数会为每个令牌调用一次,且必须返回新数组(推荐用于动态属性)。
示例
VuePress Theme Hope 十分强大。
示例
VuePress Theme Hope !!十分强大!!。与上游参考实现的完整对比见对比报告。