-
Notifications
You must be signed in to change notification settings - Fork 351
Add unencoded link target for functions with special chars #754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hello, @cybrox! This is your first Pull Request that will be reviewed by Ebert, an automatic Code Review service. It will leave comments on this diff with potential issues and style violations found in the code as you push new commits. You can also see all the issues found on this Pull Request on its review page. Please check our documentation for more information. |
Won't this generate duplicate IDs for most cases though? And I am assuming that if we drop the |
@josevalim You are right, no idea how I didn't realise that. While it would technically work, it's definitely not a clean solution according to the specs. I have not yet found a browser that caused problems with the non-encoded id's using only
The more pragmatic - and probably safer - solution in terms of browser support would probably be to just wrap the unencoded anchor in an |
@cybrox the if approach sounds good to me, thanks! |
Re-pushed the feature branch with the respective helper :) |
|> h() | ||
end | ||
|
||
@doc false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function can be private because the template is executed in this module? Or have you ran into issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works fine when private and I don't think a similar issue will arise with epub
s, I'll make it private.
❤️ 💚 💙 💛 💜 |
When merged, this will fix #509
Firefox (and probably other browsers) expect the URI of an anchor to be urlencoded
but the actual target to be NOT encoded. Due to this behaviour, links to functions
with special characters won't work.
While RFC3986 is very clear on how URIs have to be formatted, there is no clear
specification on how link targets actually should (or shouldn't) be encoded.
There are lose guidelines for HTML4/HTML5 but they rarely cover special characters.
Since most browsers seem to have adapted to also match encoded anchor targets,
this commit does not change but only extend the current behaviour by adding a
second, unencoded target to the template, similar to what is already done when
linking to a function with optional parameters, which results in target links
with different arity.