https://sourceforge.net/p/calibre/wiki/markdown_syntax/
Search for ## to find the section about how many #s to use for the desired sizes of the text (h1, h2, h3, etc).
No, I don't think it matters if the # or ## or ### are above or at the left of the section or chapter headings. You might not even have any section headings, so it doesn't matter.