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.



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.

Diff Detail

rPHU libphutil
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Mar 26 2019, 8:40 PM
epriestley requested review of this revision.Mar 26 2019, 8:40 PM
epriestley added inline comments.Mar 26 2019, 8:41 PM

This is quite a test case.

amckinley accepted this revision.Mar 26 2019, 9:02 PM
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.

epriestley updated this revision to Diff 48519.Mar 26 2019, 9:10 PM
  • 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.