Wierd behaviour of insertNewlineContinueMarkup with lists

Imagine this markdown (| is cursor)

1.| One
2. Two

And I call insertNewlineContinueMarkup(), currently I get this:

1.
2.  One
3. Two

But the first line is "1." (no space), and the second line is "2. One" (two spaces).

I should mention that in this scenario:

  • Github doesn’t continue markup
  • JetBrains IDE continue it asif the cursor was "1. |" (even though its "1.| ").

Could you update?

This behavior looks quite reasonable to me.

1 Like

I mean, it’s okay that it adds the element, and I guess it’s okay that it leaves two spaces in item 2. "2. One" (two spaces), I agree.

But could we edit it so that there’s a space added after the "1."?

"1." // could we add a space here?
"2.  One"
"3. Two"

The command intentionally doesn’t leave trailing space on lines.

1 Like

Can you explain your rationale?

I don’t wish to argue, it’s just my users ask me for that space after the 1.. If you could explain your reasons, I could explain it to them.

Many linters complain about trailing space, and many editors implicitly remove it by default, so it seems like most users wouldn’t appreciate it being inserted automatically.

Okay, that makes sense.

Do you think it would be okay if you could show me how to edit your command so that it doesn’t carry the space and does include it automatically?

I don’t need it in the library, but I would like to have a custom command, so that I can paramrtrize it for the users.

Some of them use JetBrains IDE and are used to the automatic space, so maybe I could use my custom command made in the example of insertNewLineContinueMarkup but with the space?