12

I just noticed that the Community user edited some of my Meta Stack Overflow posts to CommonMark.

It would appear (I'm pretty sure, but there's no way to know now because the renderer has changed) that this process ruins long-running list items spanning more than two paragraphs.

E.g. I had before:

- First list item.

 The first list item continues. One leading space makes sure of that.

 And this is still the first list item, continued still, thanks, single leading space.

- Finally, the second list item begins

Community edited it to add the now-required additional leading space, but only for the first continuation and not the second:

- First list item.

  The first list item continues. There are now two leading spaces, the robot did that.

And this is now a stray paragraph, not a part of the list, with no leading space at all. The list is broken.

- Finally, the second list item begins. But actually it's now beginning of a new list because of the break above.
3
  • Could you edit one of your posts into the question as an active example? Or just the revision where the Community user made the incorrect conversion?
    – Spevacus Mod
    Commented Jun 6, 2020 at 17:41
  • @Spevacus That would be meta.stackoverflow.com/posts/393568/revisions, but I wasn't sure if it was helpful to bring that particular one up along with its controversial nature, so I didn't. I'm 99% positive everything between the list items was a list item, and some after too.
    – GSerg
    Commented Jun 6, 2020 at 17:46
  • 2
    Ooh... Yeah, that one is a bit spicy, as it were. I suppose it's fine as a comment. Thank ya! Also, yeah, I see the problem you're talking about.
    – Spevacus Mod
    Commented Jun 6, 2020 at 17:47

2 Answers 2

5

This doesn't look like a bug to me. The issue you linked seems to have a different structure than what you're describing in your original question. Looking at the edit history, it was structured like this

- a list item

 an indented (single space!) paragraph

an unindented (no space) paragraph

The CommonMark migrator thinks that the indented paragraph belongs to the list item, but isn't indented far enough (it needs to align with the first word character of the list item line) so it adds more spaces until it matches.

The seconds paragraph was never indented to begin with. That's why it remains unindented after the migration.

The fact that the migration history is showing the old rendered (HTML) version differently from the new rendered (HTML) version is caused by the unfortunate fact that moving forward, we're using the new renderer even to display old rendered revisions. We have to calculate the HTML on the fly here as we only ever store the latest revision of the baked HTML. The truth is that the old Markdown renderer rendered the first, single space indented paragraph as a continuation of the list item while the second, unindented paragraph was a regular paragraph outside of the list item.

1
  • 4
    You are correct - but I am also kind of correct! My initial revision contained the indents that I meant, which can now only be seen in the markdown, then in revision 2 Peter Mortensen incorrectly removed my indents, which I did not notice then and did not notice now because now my oldest (correct) revision renders with incorrect indentations.
    – GSerg
    Commented Jun 8, 2020 at 16:37
3

This appears to be the same (or similar) issue to the one I posted for block quotes:

https://meta.stackexchange.com/a/348897/281934

Turns out there's a bug in the markdown autofixer: When a line preceding a blockquote contains a hyphen, a subsequent blockquote will be indented. I've got a repro and will fix this now so we don't run into this for upcoming migrations.

and also mentioned here: https://meta.stackexchange.com/a/348750/281934

First migrations are looking promising. I'm looking into a few tweaks around lists + indented blockquotes [...]

2
  • I'm confused why there are issues to begin with. We have the old markdown parser, we have the new markdown renderer, we have the old markdown text. Pass the old markdown text through the old markdown parser, fish out the AST. Feed the AST to the new markdown renderer, get both new markdown and new html.
    – GSerg
    Commented Jun 7, 2020 at 7:08
  • 1
    @GSerg it's not that simple. The old markdown renderer doesn't use an AST but is based on raw text transformations using regular expressions.
    – Ham Vocke StaffMod
    Commented Jun 8, 2020 at 13:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .