QuantumBadger / RedReader

An unofficial open source Android app for Reddit.
GNU General Public License v3.0
1.94k stars 480 forks source link

[feature request] Be more forgiving about parsing spoiler tags. #1136

Open nascentt opened 11 months ago

nascentt commented 11 months ago

I constantly stumble across spoilers in redreader that aren't masked because redreader won't process the spoiler tags because of spaces.

Example:

The following is not successfully hidden behind a spoiler box.

>! One two three. !<

The below is hidden behind a spoiler box.

>!one two three. !<

As other clients (including new.reddit.com) do hide spoiler tags regardless of spacing it means users are nonthewiser and leave them, and only us redreader users are spoiled.

It's been this way for years, and has bitten me many times. Probably time to improve it.

Example comment

https://reddit.com/comments/16pvguf/comment/k20cw4y?context=3

(Funnily enough old.reader.com also processes spoilers the way redreader does. Whilst new.reddit.com parses them regardless of space, typical Reddit being inconsistent)

QuantumBadger commented 10 months ago

Thanks for the detailed report!

We don't actually parse the markdown any more, we parse the HTML in the body_html field. Unfortunately the HTML Reddit is giving us doesn't indicate that those paragraphs are spoilers.

Example spoiler paragraph:

<span class=\"md-spoiler-text\">Yebun touched him in previous episode to check his alibi and he was found wandering and almost got hit by a car at around 8pm. Then he went to the workshop to take a nap and woke up at 9pm. Assuming that the killer has a way to create blackouts, there is a chance that he &quot;took a nap&quot; to create alibi then went out and kill during his &quot;nap time&quot;. </span>

Example broken paragraph:

<p>&gt;! I have a theory that being in the dark helps create the blackouts. Because closing your eyes do not make you stop seeing, it just makes you see &quot;darkness&quot;. So the same effect can be created by, for example, turning off the light switch, or wearing sunglasses. Or both at the same time. !&lt;</p>

One easy solution would be to treat any <p> tags which start with &gt;! as a spoiler.

QuantumBadger commented 10 months ago

There's also the question of spoilers mid-paragraph -- there's another inline spolier on that page surrounded by &gt;! and !&lt; which we could parse and turn into a spoiler node in the tree.