Fixing invalid markdown sequences