Refactor Markdown Parser Logic

It's absolutely insane in there. Let's clean it up.