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 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 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 removed this from the v0.63 milestone Jan 22, 2020
@bep bep added this to the v0.64 milestone Jan 22, 2020
@Brixy
Copy link
Author

@Brixy 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

@matteocontrini matteocontrini commented Jan 23, 2020

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 removed this from the v0.64 milestone Jan 30, 2020
@bep bep added this to the v0.65 milestone Jan 30, 2020
@bep bep removed this from the v0.65 milestone Feb 18, 2020
@bep bep added this to the v0.66 milestone Feb 18, 2020
@bep bep removed this from the v0.66 milestone Mar 2, 2020
@bep bep added this to the v0.67 milestone Mar 2, 2020
@bep bep removed this from the v0.67 milestone Mar 9, 2020
@bep bep added this to the v0.68 milestone Mar 9, 2020
@bep bep removed this from the v0.68 milestone Mar 20, 2020
@bep bep added this to the v0.69 milestone Mar 20, 2020
@bep bep removed this from the v0.69 milestone Apr 8, 2020
@bep bep added this to the v0.70 milestone 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 removed this from the v0.70 milestone Apr 28, 2020
@bep bep added this to the v0.71 milestone Apr 28, 2020
@bep bep removed this from the v0.71 milestone May 18, 2020
@bep bep added this to the v0.72 milestone May 18, 2020
@DJCordhose
Copy link

@DJCordhose DJCordhose commented May 26, 2020

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

@bep bep removed this from the v0.72 milestone May 31, 2020
@bep bep added this to the v0.73 milestone May 31, 2020
@bep bep removed this from the v0.73 milestone Jun 23, 2020
@bep bep added this to the v0.74 milestone Jun 23, 2020
@bep bep removed this from the v0.74 milestone Jul 13, 2020
@bep bep added this to the v0.75 milestone Jul 13, 2020
@bep bep removed this from the v0.75 milestone Sep 14, 2020
@bep bep added this to the v0.76 milestone Sep 14, 2020
@bep bep removed this from the v0.76 milestone Oct 6, 2020
@bep bep added this to the v0.77 milestone Oct 6, 2020
@bep bep removed this from the v0.77 milestone Oct 30, 2020
@bep bep added this to the v0.78 milestone Oct 30, 2020
@Shelim
Copy link

@Shelim 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 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 removed this from the v0.78 milestone Apr 23, 2021
@bep bep added this to the v0.83 milestone Apr 23, 2021
@bep bep removed this from the v0.83 milestone May 3, 2021
@bep bep added this to the v0.84 milestone May 3, 2021
@bep bep removed this from the v0.84 milestone Jun 18, 2021
@bep bep added this to the v0.85 milestone Jun 18, 2021
@bep bep removed this from the v0.85 milestone Jul 5, 2021
@bep bep added this to the v0.86 milestone Jul 5, 2021
@jmooring
Copy link
Member

@jmooring jmooring commented Jul 15, 2021

Fixed with #8756

@github-actions
Copy link

@github-actions github-actions bot commented Jan 18, 2022

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