Markdown: Fix preview pane

Get ContentType from document TextBuffer
instead of primary (projection) TextBuffer.

Also cleanup code.