Page MenuHomePhabricator

In remarkup, strip one leading space from each line in a quoted block if possible

Authored by epriestley on Mar 26 2019, 8:40 PM.
Referenced Files
Unknown Object (File)
Thu, Apr 11, 8:20 AM
Unknown Object (File)
Fri, Apr 5, 10:34 PM
Unknown Object (File)
Wed, Apr 3, 11:24 PM
Unknown Object (File)
Wed, Apr 3, 11:24 PM
Unknown Object (File)
Mon, Apr 1, 10:49 PM
Unknown Object (File)
Mon, Apr 1, 10:40 PM
Unknown Object (File)
Mon, Apr 1, 7:54 PM
Unknown Object (File)
Mon, Mar 25, 7:39 AM
"Orange Medal" token, awarded by Krinkle.



Fixes T13268. Currently, when we quote text, we add > (with a space) but don't try to strip it when un-quoting text.

Instead, try to strip it.

We can still end up with some occasional weird cases (users manually typing ">") that we may have to refine eventually, but this should make the common case ("Quote" button in the UI) work more consistently.

Test Plan

Added a test, made it pass.

Screen Shot 2019-03-26 at 1.37.43 PM.png (595×378 px, 22 KB)

Diff Detail

rPHU libphutil
Lint Not Applicable
Tests Not Applicable

Event Timeline


This is quite a test case.

amckinley added inline comments.

We don't want to just keep doing this whole process in a loop until it's no longer true?

This revision is now accepted and ready to land.Mar 26 2019, 9:02 PM

We would, except that a two space indent creates a code block. So if you type this:

__abcd get this:


That quotes as:

>   abcd

With 3 spaces.

This change strips it to 2 spaces so it still works, but if we strip all spaces it'll un-code-block it.

I thought there was a test case for that already (quoted-code-block.txt) but that actually just tests a triple-backtick version. I'll add a space-to-indent version.

  • Add an explicit test case for >, three spaces, then text (which should be a code block).
This revision was automatically updated to reflect the committed changes.