[markdown mode] Fix XML styling in Markdown mode

Fix the condition when XML styling should be invoked.
Also add test cases.