The Stack Exchange already has a special spoiler markdown tag on its movie/tv/etc. sites that works like this:
>! E.T. phones home!
and outputs a blockquote with the class “spoiler”:
<blockquote class="spoiler">
<p>E.T. phones home!</p>
</blockquote>
Even though there are some arguments against it, I think that an inline-type spoiler tag might be useful too (especially since on reddit, a lot of subreddits have improvised inline spoiler tags using CSS on links like this: [spoiler text](#spoiler)
)
In a pull request I made to reddit’s markdown parser Snudown, I thought up what an inline spoiler tag could look like:
This is a sentence >!with a spoiler in it.!<
Which would output:
This is a sentence <span class="spoiler">with a spoiler in it.</span>
Though, I wonder if it would make a line that starts with an inline spoiler trickier to to write a parse for, like:
>!Spoiler at the beginning!< of this sentence
may render like:
<blockquote class="spoiler">
<p>Spoiler at the beginning!< of this sentence</p>
</blockquote>
instead of:
<span class="spoiler">Spoiler at the beginning</span> of this sentence
sometimes.
Because there’s a nice port of snudown to emscripten, I built it and made a quick test page of my modded snudown based off of the stmd.js test page so people can see this idea in action
https://arresteddevelopment.github.io/spoiler-test/
Would having both an inline-style and a blockquote-style spoiler tag be useful, or would it be less confusing if just one style was picked? I imagine the blockquote style would be best, as it falls back better when text is pasted where spoiler tags aren’t supported