This is fantastic! I'm sending my contribution now.
When testing it out, I'm noting one quirk, which is that for some books there are one or more square-bracketed snippets of text within the URL location (specifically in the epubcfi string) that are unescaped and "break" the Markdown link, e.g. [ch1] in the following
Code:
epubcfi%28/14/2/4/2[ch1]/138/1:0%29
I'm not sure how to reproduce the bug exactly (if it is a bug). It does seem that, in all cases thus far, simply deleting the bracketed snippets solves the problem, i.e. the link is functional and still opens the ePub at the right location. I'm not sure whether that suggests a solution. In the meantime, I can simply delete by hand as a workaround in the cases where it occurs.
Thanks again. This is an amazing tool for me!