Markdown clean

Some cleaning for the markdown library.

The moved method `token_at` will be used in a further PR.