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

Go Modules URI incorrectly parsed as mailto link #260

Open
picatz opened this issue Sep 18, 2023 · 1 comment · May be fixed by #261
Open

Go Modules URI incorrectly parsed as mailto link #260

picatz opened this issue Sep 18, 2023 · 1 comment · May be fixed by #261

Comments

@picatz
Copy link

picatz commented Sep 18, 2023

Similar to #82, Go modules are incorrectly rendered as mailto links.

Given a module like golang.org/x/[email protected], it is rendered as:

golang.org/x/[email protected] mailto:golang.org/x/[email protected] 

It'd be nice if there was an option to disable mailto links for a given regular expression, or all together.

@picatz
Copy link
Author

picatz commented Sep 18, 2023

Looking into what it would take to implement this, it looks like mailto: is added here:

glamour/ansi/elements.go

Lines 229 to 231 in ea72398

if n.AutoLinkType == ast.AutoLinkEmail && !strings.HasPrefix(strings.ToLower(u), "mailto:") {
u = "mailto:" + u
}

We can add additional options for the ANSI renderer's context here:

glamour/ansi/renderer.go

Lines 17 to 23 in ea72398

type Options struct {
BaseURL string
WordWrap int
PreserveNewLines bool
ColorProfile termenv.Profile
Styles StyleConfig
}

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 a pull request may close this issue.

1 participant