I wasn't handling line breaks and blank lines so I added in some logic to account for both those cases. It got tricky when an inline mark (bold, emphasis, etc.) was split because line breaks are valid in markdown.
__foo bar
baz__
Even though it's unlikely I will split bold text across lines like this, someone might. I think it's important to spend extra time right now to get the little details right.
The editor also handles backlashes better than before too. Adding backlashes or escaped characters (\@
) shifted the showing/hiding syntax off track before.