Discourse Spoiler Alert provides the ability to hide content marked with a [spoiler] tag in posts.
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:
Features
Once enabled it adds a ‘Blur Spoiler’ option to the 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:
[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
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)
Есть ли способ изменить то, как выглядит превью спойлера? Текущая реализация выглядит неплохо, но она недостаточно скрывает суть спойлера.
Вот пример из созданной мной темы, где пользователи могут загружать свои скриншоты. Если скриншот является спойлером, его нужно пометить соответствующим образом. Как вы видите, текущая реализация не совсем подходит для маркировки спойлеров скриншотов с ключевыми моментами игр, фильмов и т. д.
Любой, кто знаком с игрой, которую я упомянул, сразу поймёт, что изображено.
Редактирование: Мне также стало известно, что если любой пользователь перейдёт к истории редактирования поста, содержащего спойлеры, история редактирования не будет скрывать содержимое с помощью спойлер-тегов.
Если вы хотите увеличить размытие при наведении курсора на изображение, добавьте следующие строки и измените 0.5em (на значение меньшее, чем предыдущее):