Parse link reference definitions
Add collapsed and full reference links
Small bugfixes
Update tests