Escape relative permalinks

The implementation in f5839c2 doesn't catch many characters which should
be escaped, such as normal single and double quotes along with ampersand
and equals symbols. When used, these created broken URLs, such as the
following (since nokogiri changes `'` into `"`).

    http://guides.cocoapods.org/using/troubleshooting.html#i

    <h3 id="i'm-getting-permission-errors-while-running-pod-commands">
        <a class="header-link" href="#i"m-getting-permission-errors-while-running-pod-commands="">&lt;</a>I'm getting permission errors while running pod commands</h3>