Discourse Spoiler-Alert

:discourse2: Summary Discourse Spoiler Alert provides the ability to hide content marked with a [spoiler] tag in posts.
:open_book: Install Guide This plugin is bundled with Discourse core. There is no need to install the plugin separately.

Enabling Spoiler Alert

This plugin is default enabled once installed but can be disabled/enabled from its settings, accessed from your admin/plugins page:

enable spoiler

Features

Once enabled it adds a ‘Blur Spoiler’ option to the :gear: menu in the composer’s formatting bar. Simply highlight the text you’d like to blur and select ‘blur spoiler’ and it will wrap the selected text in the necessary [spoiler] tags:

Examples:

Inline:

[spoiler]This is a spoiler[/spoiler] 

This is a spoiler

Multiline:

[spoiler]

I wanna be your vacuum cleaner
Breathing in your dust
I wanna be your Ford Cortina
I will never rust
If you like your coffee hot
Let me be your coffee pot
You call the shots
I wanna be yours

https://johncooperclarke.com/poems/i-wanna-be-yours

[/spoiler]

I wanna be your vacuum cleaner
Breathing in your dust
I wanna be your Ford Cortina
I will never rust
If you like your coffee hot
Let me be your coffee pot
You call the shots
I wanna be yours

https://johncooperclarke.com/poems/i-wanna-be-yours

Clicking on the blur will reveal the hidden text, and clicking again will re-blur it.

It also works for images:
(to re-blur an image that is large enough to generate a lightbox, you can click on the adjacent white space or refresh the page)

Settings

Name Description
spoiler enabled Enable the spoiler plugin. If you change this, you must rebake all posts with: “rake posts:rebake”[1]

:discourse2: Hosted by us? This plugin is available on all of our hosting tiers Spoiler Alert | Discourse - Civilized Discussion


  1. :discourse2: If you’re a hosted customer of ours, please contact team@discourse.org if you have any questions about needing to ‘rebake’ due to a setting change ↩︎

Last edited by @tobiaseigen 2025-07-16T20:45:02Z

Check documentPerform check on document:
48 个赞

移至核心:

3 个赞

:information_source: Discourse Spoiler Alert 现已捆绑到 Discourse 核心中,因此不再需要单独安装此插件。 :partying_face:

如果您是自托管用户,您应该会在仪表板上看到有关从 app.yml 中移除它的信息。

:discourse2: 由我们托管?此更改不会以任何方式影响您。 :+1: 您可以继续使用此插件,无需担心任何问题。

1 个赞

我不明白为什么这个插件默认启用。它不只对电影论坛有用吗?

隐藏文本的原因有很多,比电影剧透或笑话的包袱还要多。

2 个赞

是否可以添加一项功能,在点击帖子上的“喜欢”后显示隐藏内容?

您非常欢迎创建一个 Feature spoiler-alert 主题 :wink:

2 个赞

:wink:,我正在路上。

是否有办法编辑预览剧透的外观?目前的实现效果不错,但就剧透的内容而言,它不够抽象。

以下是我创建的一个帖子的示例,用户可以在其中上传他们的截图。如果截图是剧透,则需要将其标记为剧透。正如你所看到的,目前的实现方式在对游戏、电影等关键时刻的截图进行剧透标记的上下文中并不奏效。

任何熟悉我分享的游戏的人都会立即知道这是什么。

下面是我 Discourse 版块的图片。

有什么方法可以调整这个吗?

编辑: 我还注意到,如果任何用户点击包含剧透的帖子的编辑历史记录,编辑历史记录不会对内容进行剧透标记。

您打算让它变得更模糊吗?还是让模糊变成另一种颜色?

1 个赞

如果可以的话,我会把它完全变成黑色,或者让它更模糊。

这是模糊部分的默认 CSS

.spoiler-blurred img {
  filter: blur(1em);
}

将 1em 更改为更重要的值

.spoiler-blurred img {
  filter: blur(5em);
}

如果您想在光标悬停在图像上时模糊更多,请添加这些行并将 0.5em 更改为(小于之前的值)

.spoiler-blurred {
  .discourse-no-touch & {
    &:hover, &:focus {
      img {
        filter: blur(0.5em);
      }
    }
  }
}
4 个赞