An event-based parser for markdown text