Links generation were broken for plain-text version in some case

Thanks to Georg Schönweger for providing a patch