URLs in a['href'] should be escaped for LaTeX #67

wants to merge 1 commit into


None yet
3 participants

hperl commented Jul 16, 2013

An URL such as in a a['href'] can contain URL escape codes, which all start with a %. The LaTeX-converter should escape all % to \% using escape(), or otherwise the unescaped % will be treated like a comment in LaTeX, corrupting the file.

This pull request fixes this by calling escape() on the URL.

gettalong was assigned Jul 29, 2013


gettalong commented Aug 21, 2013


gettalong closed this Aug 21, 2013

I think this is actually wrong, escaping breaks for instance urls with a tilde in them. The hyperref manual says that " The special characters # and ̃ do not need to be escaped in any way.". Unfortunately, it does not say anything about other characters...


gettalong commented Sep 28, 2016

@mkamensky Thanks for your comment - do you have any test cases for this?

Yes, this comes from my real life example:

echo '<https://www.math.bgu.ac.il/~amyekut/teaching/2016-17/der-cats-III/course_page.html>' | ruby -rkramdown -e 'puts Kramdown::Document.new(ARGF.read).to_latex'

It produces


which does not compile. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment