• 
      

    Escape leading spaces and tabs in markdown processing.

    Review Request #6200 — Created Aug. 5, 2014 and submitted — Latest diff uploaded

    Information

    Review Board
    release-2.0.x
    15b0600...

    Reviewers

    When escaping plain text as markdown, we need to handle leading spaces (four or
    more) and leading tabs, as these blocks are considered to be code samples. This
    meant that some basic syntax highlighting would be applied (often erroneously),
    and that URLs were not properly linked.

    After experimenting for quite some time with escaping the first tab or space, I
    gave up on that approach. Markdown renderers do not handle escaped spaces well.
    The solution that I settled on was to replace the first space with a
    non-breaking space entity (for leading spaces), and prepend the line with an
    nbsp (for leading tabs). This renders correctly while still allowing us to
    escape and unescape.

    • Reproduced the bug (using --description="$(git log -n 1)" in rbt post) and
      saw that it indented the commit message without treating it as a code block.
    • Used the API with ?force-text-type=plain to verify unescaping of the nbsp
      entities.
    • Ran unit tests.