Fix unescaped ampersands in bookmark links

Fixes issue #322 where the ampersands in bookmark links were not being escaped. This required a new filter which actually had some use in other places that I found so I applied it to those to reduce code duplication.