Skip to content
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

Add support for custom anchor element attributes to fmt_url() #1428

Closed
2 tasks done
elipousson opened this issue Sep 1, 2023 · 1 comment
Closed
2 tasks done

Add support for custom anchor element attributes to fmt_url() #1428

elipousson opened this issue Sep 1, 2023 · 1 comment
Assignees

Comments

@elipousson
Copy link
Contributor

elipousson commented Sep 1, 2023

Prework

Proposal

I recently realized that the fmt_url() function does not allow custom attribute values and has the target attribute hard-coded as "_blank". Adding support for custom attributes to the fmt_url() function would add greater flexibility how the links are created. Support for other custom attributes including hreflang, ping, referrerpolicy, rel, and type could be added at the same time.

I used the documentation on the supported attributes for anchor elements ("") from the mdn developer docs as a reference in setting up the validation: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes

elipousson added a commit to elipousson/gt that referenced this issue Sep 1, 2023
elipousson added a commit to elipousson/gt that referenced this issue Sep 1, 2023
Also rename `add_href_attr` helper to more accurate `add_anchor_attr`
@elipousson
Copy link
Contributor Author

I think I've got a decent implementation for this feature ready to go on my fork, @rich-iannone.

If it looks good for a pull request, just let me know and I can add some tests as well. If you'd recommend a different approach for implementation, feedback would be welcome.

rich-iannone added a commit that referenced this issue Oct 5, 2023
Add custom attribute support to `fmt_url` (#1428)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants