madskristensen / MarkdownEditor

A Visual Studio extension
Other
409 stars 93 forks source link

<tag> causes indentation and formatting issues #96

Open LordZoltan opened 7 years ago

LordZoltan commented 7 years ago

This bug applies to one of my two VS installations only(!) - the options set for the Markdown editor are the same on both.

Installed product versions

Description

If I enter content which parses as an (X)HTML opening tag, e.g:

then the editor will subsequently interpret that as an unclosed html tag, first adding the close tag for me by default, but then causing all subsequent new lines to be auto-indented for the rest of the document.

The problem magnifies when inserting new lines into existing blocks of text, because both the new line and all following lines are then indented by the auto-formatter, in some cases completely munging the content.

I've tried modifying the Markdown editor options to switch off auto-indenting; but it doesn't appear to fix the issue.

My laptop installation does not do this (same version of VS and the extension), this is on another machine. So I'm guessing there might be some other option set which affecting it. As mentioned in the intro, the options for the markdown editor itself are the same on both.

Steps to recreate

Add a new markdown file Type '<Hello>' in it, remove the automatically created closing tag and hit return The caret will be indented.

It appears to me as if the markdown editor on the affected machine is operating more like a mixed-mode HTML/Markdown editor - as it's also auto-inserting html close tags, which the unaffected machine also does not do.

Any advice welcome. Initially just looking for any hints as to why this might be happening (a dodgy extension perhaps? although both machines also have the same extensions!)

Thanks!

LordZoltan commented 7 years ago

I have more detail:

On the affected machine, I can stop this behaviour by changing the text editor options for HTML:

HTML -> Tabs -> Indenting: None HTML -> Advanced -> Auto insert closing tag: False

On my laptop (where the editor works as expected), these options are set to 'Smart' and 'True' respectively.