Improved Markdown titles detection