diff --git a/contrib/html.sh b/contrib/html.sh
index d4a1a90..603e606 100755
--- a/contrib/html.sh
+++ b/contrib/html.sh
@@ -11,7 +11,7 @@ sed \
< "${0}.d/head.html"
markdown -f toc,idanchor "${1}" | sed \
- -e 's/href="\([-_\./[:alnum:]]*\)\.md"/href="\1.html"/g' \
+ -e 's/href="\([-_\./[:alnum:]]*\)\.md\(#[-[:alnum:]]*\)\?"/href="\1.html\2"/g' \
-e '/| id="\L\1">|'
printf '