Hard break (shift return) breaks subsequent markdown formatting

Hello,

I’ve encountered an undesirable behavior in my ProseMirror implementation. You can reproduce with the following steps:

  • Input some text
  • At the end of the line, press shift+return to insert a hard break
  • On the new line, input ## followed by some text to create a heading, note that the text doesn’t format to a heading like it normally would.
  • You can not input markdown until you input another normal return/line break

I was able to replicate this behavior in the sample ProseMirror editor on the homepage so I don’t think its something specific to my implementation. Does anyone have suggestions on how to preserve the ability to input markdown after a shift+return input?

Thank you!

The input rule that turns ## into a heading intentionally only fires at the start of a textblock. After a hard break you’re still in the same block as the text above.

Hi Marjin, thank you for your reply. Is there a way to override that behavior so that a hard break creates a new textblock?

Hard breaks are inline elements inside of a textblock, so having a hard break create a new textblock makes no sense. You could bind shift-enter to do something else, or write your own custom input rule that handles hash characters after a hard break.