[markdown mode] Fix bug in innerMode

Closes #2139