Fix markdown go blank issue

@samccone, I made some change on top of your change that seems to have address the scope/editor mismatching causing editor go blank or wrong focus issue. I am still seeing the whitespace growing though. Please review and see if it makes sense to merge into your branch.