Fix rendering of Contents when links are present

Fixes Haddock Trac #267.