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

Support markdown autolinks with Markdown Render Hooks #6667

Closed
Brixy opened this issue Dec 25, 2019 · 8 comments
Closed

Support markdown autolinks with Markdown Render Hooks #6667

Brixy opened this issue Dec 25, 2019 · 8 comments

Comments

@Brixy
Copy link

Brixy commented Dec 25, 2019

Hugo 0.62.0

Given this render-link.html code

<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>

Markdown auto links are currently not supported.

In:

<http:/test.com>

Out:

<a href="http:/test.com">http:/test.com</a>

In (works as expected):

[Test](http:/test.com)

Out:

<a href="http:/test.com" target="_blank" rel="noopener">Test</a>

Thank you!

@Brixy Brixy added the Proposal label Dec 25, 2019
@bep bep added this to the v0.63 milestone Dec 25, 2019
@Rarst
Copy link

Rarst commented Jan 2, 2020

Goldmark seems to support an even more freeform GFM autolinks without any delimiters https://github.github.com/gfm/#autolinks-extension-

Also completely un-marked-up link is a convention for automated embeds and having them run through hook would be very powerful for that purpose. Think lone twitter link by itself getting turned into full embedded tweet.

@bep bep modified the milestones: v0.63, v0.64 Jan 22, 2020
@Brixy
Copy link
Author

Brixy commented Jan 23, 2020

Thanks a lot for v0.63.0!

This issue seems to be solved now, too—at least in all my use cases.

@bep bep closed this as completed Jan 23, 2020
@matteocontrini
Copy link

It doesn't seem to be fixed for me. Autolinks still don't invoke the render hook...

@bep bep reopened this Jan 23, 2020
@bep bep modified the milestones: v0.64, v0.65 Jan 30, 2020
@bep bep modified the milestones: v0.65, v0.66 Feb 18, 2020
@bep bep modified the milestones: v0.66, v0.67 Mar 2, 2020
@bep bep modified the milestones: v0.67, v0.68 Mar 9, 2020
@bep bep modified the milestones: v0.68, v0.69 Mar 20, 2020
@bep bep modified the milestones: v0.69, v0.70 Apr 8, 2020
ct-martin added a commit to ct-martin/ctmartin-hugo-theme that referenced this issue Apr 11, 2020
Towards #10

Note: autolinks bug prevents this getting used on them: gohugoio/hugo#6667
@bep bep modified the milestones: v0.70, v0.71 Apr 28, 2020
@bep bep modified the milestones: v0.71, v0.72 May 18, 2020
@DJCordhose
Copy link

I am on 0.71 and it has not been fixed so far.

@bep bep modified the milestones: v0.72, v0.73 May 31, 2020
@bep bep modified the milestones: v0.73, v0.74 Jun 23, 2020
@bep bep modified the milestones: v0.74, v0.75 Jul 13, 2020
@bep bep modified the milestones: v0.75, v0.76 Sep 14, 2020
@bep bep modified the milestones: v0.76, v0.77 Oct 6, 2020
@bep bep modified the milestones: v0.77, v0.78 Oct 30, 2020
@Shelim
Copy link

Shelim commented Jan 14, 2021

0.80 is out and it still does not work.

Workaround: if you want to use hook for adding "target=_blank" in your URLs, use different markdown provider in your config.toml:

[markup]
  defaultMarkdownHandler = "blackFriday"
  [markup.blackFriday]
    hrefTargetBlank = true

@jmooring
Copy link
Member

jmooring commented Mar 9, 2021

To clarify, this is an autolink:

<https://www.gohugo.io>  

And with:

[markup.goldmark.extensions]
linkify = true

These are also autolinks:

www.gohugo.io  
https://www.gohugo.io 

@bep bep modified the milestones: v0.78, v0.83 Apr 23, 2021
@bep bep modified the milestones: v0.83, v0.84 May 3, 2021
@bep bep modified the milestones: v0.84, v0.85 Jun 18, 2021
@bep bep modified the milestones: v0.85, v0.86 Jul 5, 2021
@jmooring
Copy link
Member

Fixed with #8756

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants