markdown: decorator generate headline ids and save them for further use in client.

Markdown decorator now remembers outputed headlines.

This will be usefull to reconstruct headline summary from parsed markdown.

Also added a fix on outofbound exception.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>