Fix bad markdown performance

This fixes the bad performance of markdown parsing.