clean up doc link parsing in preparation for #1065