Discourse Spoiler-Alert

:mega: This plugin is now bundled with Discourse core and is enabled by default**. There is no need to install the plugin separately.

:discourse2: Summary Discourse Spoiler Alert provides the ability to hide content marked with a [spoiler] tag in posts.
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-spoiler-alert
:open_book: Install Guide How to install plugins in Discourse

Enabling Spoiler Alert

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

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 @JammyDodger 2024-06-03T21:58:31Z

Check documentPerform check on document:
48 Likes

Moved to core:

3 Likes

:information_source: Discourse Spoiler Alert has now been bundled with Discourse core, so this plugin will no longer need to be installed separately. :partying_face:

If you self-host you should see some information on your dashboard about removing it from your app.yml.

:discourse2: Hosted by us? This change will not affect you in any way. :+1: You can continue to enjoy this plugin and not worry about a thing.

1 Like

I don’t understand why this plugin is enabled by default. Isn’t it only useful for movie forums?

There are plenty of reason to hide text than movie spoilers. More than punchlines of jokes.

2 Likes

Is it possible to add a feature to show the spoiler content after clicking ‘like’ on the post?

You’re more than welcome to create a feature spoiler-alert topic :wink:

2 Likes

:wink:, I’m on my way.

Is there anyway to edit the contents of how the spoiler preview looks? The current implementation looks nice, but it doesn’t abstract enough as far as what it’s spoiling.

Here’s an example from a thread I made, where users can upload their screenshots. If the screenshot is a spoiler, it needs to be tagged as such. As you can tell, the current implementation doesn’t really work in the context of spoiler tagging screenshots of critical moments in games, movies, etc.

Anyone who is familiar with the game I shared would immediately know what it is.

Image from my discourse board below.

Is there a way to adjust this?

Edit: It’s also come to my attention that if any user clicks the edit history of a post that contains spoilers, the edit history will not spoiler tag the contents.

What are you planning to make it like? More blurry? A different color of the blur?

1 Like

If I could, I’d either turn it completely black, or make it blurrier.

Here is the default css for the blur part

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

Change the 1em to something more important

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

And if you want to blur more when the cursor is on the image, add these line and change the 0.5em (with a value less important than the one before)

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