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 option to disable auto email mailto: links #261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

picatz
Copy link

@picatz picatz commented Sep 18, 2023

This PR aims to fix #260 and #82 by adding an option to disable auto email mailto: links.

@@ -227,6 +227,13 @@ func (tr *ANSIRenderer) NewElement(node ast.Node, source []byte) Element {
u := string(n.URL(source))
label := string(n.Label(source))
if n.AutoLinkType == ast.AutoLinkEmail && !strings.HasPrefix(strings.ToLower(u), "mailto:") {
if tr.context.options.DisableAutoEmailLinks {
return Element{
Copy link
Member

@bashbunni bashbunni Oct 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for the contribution! This is a feature I know people are interested in.

One thing to keep in mind is this also strips the link styling of anything that looks like an email. Do we want to keep the ability to style these components with custom styles? Would be great to hear your thoughts :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 Thank you for the review!

For my own use case, I would prefer to just remove the styling for anything that looks like an email. But, I can totally see other people's use case where they want to modify the style instead.

Happy to modify this PR if you think we should not just disable email auto links, but allow them to be disabled or otherwise manipulated through a custom style. But, I might need a little more time to get that sorted out.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 @bashbunni, just wanted to follow up on this again. Should I try to update this PR to keep the ability to style these components?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @picatz I'm going to leave it open for now, I'm currently doing a big refactor of glamour, so will take a look again once that's done.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, thank you for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Go Modules URI incorrectly parsed as mailto link Wrong rendering assumption when using @ in markdown files
2 participants