Inspired by hexo-spoiler
npm install hexo-sliding-spoiler --saveIf hexo can't detect this plugin automatically, you need to modify the plugins section of [path_to_your_site]/_config.yml manually, like:
plugins:
- hexo-sliding-spoiler{% sliding_spoiler title %}
content
{% endsliding_spoiler %}
It will hide your text and place the title at the top with a dropdown/scroll up arrow.
⚠️ Breaking change (v2.0.0): The tag was renamed from{% spoiler %}to{% sliding_spoiler %}to avoid conflicts with hexo-spoiler. Update your posts to use the new tag name.
{% sliding_spoiler word %}
content
{% endsliding_spoiler %}
{% sliding_spoiler "Several spaces in the title" %}
content
{% endsliding_spoiler %}
Markdown code fences (triple backticks) inside spoiler tags can cause parsing
issues due to a Hexo/Nunjucks limitation.
Use Hexo's built-in codeblock tag instead:
{% sliding_spoiler "Code example" %}
{% codeblock lang:javascript %}
console.log('Hello world');
{% endcodeblock %}
{% endsliding_spoiler %}
