Tunous / Dawn

Here lies the fork of greatest open-source Reddit app
Apache License 2.0
451 stars 36 forks source link

Tables are not rendered well #337

Open mrmans0n opened 3 years ago

mrmans0n commented 3 years ago

For example, in posts like https://reddit.com/r/leagueoflegends/comments/j92oha/unicorns_of_love_vs_top_esports_2020_world/ the tables from the results are all mangled.

AbsurdlySuspicious commented 3 years ago

To be honest, current markdown implementation has a lot more flaws than just tables. I'll drop an issue number here when work on updated parser will be started

saket commented 3 years ago

IIRC the problem wasn't with the markdown parser. Reddit has had a history of allowing invalid syntax for many markdown elements including tables. It tries to help by sending HTML alongside plain markdown, but I had decided not to use that and try correcting tables manually here: https://github.com/saket/Dank/blob/39beb5bdd01bb7e1203847be4b2dde5c2fb192fc/app/src/main/java/me/saket/dank/utils/markdown/markwon/MarkwonBasedMarkdownRenderer.java#L185

In hindsight, I think trying to correct reddit's invalid markdowns was a mistake and a lost battle. Rendering their HTML is probably the only foolproof way.