On Feb 28, 2006, at 9:22 PM, Dr. Drang wrote:
Each line is indented by four spaces (the pipe characters are meant to represent the left margin), which Markdown will wrap in <pre> and <code> tags. I have TM (version 1.5 [906]) set to use soft tabs of 2 characters each.
I found that hitting the Return key after each of these lines (other than the blank one) would put the cursor on the next line with an indentation of 6 spaces instead of 4. This may be a red herring, but the extra indentation seemed to occur only after lines that had an angle-bracked pair, like <xxx>, in them. So in this excerpt
| #include<iostream> | #include<vector> | #include "d_random.h" | using namespace std;
the extra indentation occurred after the first two lines, but not after the second two.
Can anyone tell me why this is happening and what I can do to fix it?
I can explain what is happening and suggest some ideas on how to fix it. The scope for the entire markdown bundle is text.html.markdown This means that it inherits stuff from the html bundle, in general a good thing. In this case, it inherits the indentPattern behavior, that you would see for instance if you type <html> and press enter. This is dictated in the Miscellaneous preferences file in the HTML bundle, by the following code:
increaseIndentPattern = '(?x) (<(?!area|base|br|col|frame|hr|html|img|input|link|meta|param|[^>]*/>) ([A-Za-z0-9]+)\b[^>]*>(?!.*</\2>) |<!--(?!.*-->) |{[^}"'']*$ )';
I think what you have to do is create such a file in the Markdown bundle, with an appropriate increase indent pattern and scope text.html.markdown, and hope that this will override the pattern from html. The problem with that of course is that then the html indenting will not work in markdown. I don't think that there is a simple answer here, in that we do want such indenting in markdown in general, and in fact in code blocks too, since the code blocks might often be html. It just happens to have this weird behavior if your code happens to have what looks like the opening of an html tag.
-- Dr. Drang
Haris