zulip / zulip-flutter

Future Zulip client using Flutter
Apache License 2.0
128 stars 104 forks source link

Patch up spurious vertical space after quoted code blocks #641

Open gnprice opened 2 weeks ago

gnprice commented 2 weeks ago

If you send a Zulip message with a code block inside a quotation, the code block gets followed by an extra blank line, for no good reason.

The root issue here is actually a server bug, ultimately due to the Zulip server's use of the Python-Markdown library. Its current symptom in zulip-flutter is the same symptom that Zulip web has shown for many years. But it's likely Zulip web will start patching this up at some point so that the bug no longer has user-facing symptoms, and we should do the same in zulip-flutter. (Even in a future where the server bug itself is someday fixed, it'll still likely apply to all existing messages sent before that point, so it'll remain useful for clients to patch up the issue.)

Here's a sample message, and screenshots of how it appears: web flutter (Linux)
image image

Note the quotation marker at the left extending well below the code block, by about the height of a line.

The HTML looks like this:

<blockquote>
<p><div class="codehilite"><pre>[…]</pre></div><br>
</p>
</blockquote>

Note the surrounding <p> element, and the <br>. Those wouldn't normally be there.

Thanks to @karlstolley and @andersk for diagnosing this issue.

An issue that appears related at first sight but I think ultimately isn't (except that they're both about quirky HTML emitted for code blocks) is: