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

Distinguish autolinks in render hook #9993

Open
Rarst opened this issue Jun 10, 2022 · 1 comment
Open

Distinguish autolinks in render hook #9993

Rarst opened this issue Jun 10, 2022 · 1 comment

Comments

@Rarst
Copy link

Rarst commented Jun 10, 2022

To my understanding, at the moment markdown render hooks apply equally to the three possible kinds of links in content:

  1. marked up link [example](https://example.com)
  2. autolink <https://example.com>
  3. extended autolink https://example.com

So render-link.html would fire for each one.

For the last case WordPress has popularized the convention that bare link in content is magically turned into embedded content, for services that support such.

This creates a use case where you want to hook specifically into that case and just it, without hooking into regular links.

While this is possible to try detect it with some logic (e.g. if eq .Destination .Text), I think it might be beneficial to offer an explicit way to distinguish the cases. This might be done in a ways like passing .LinkType context to the hook and/or adding more specific templates like render-link-markup.html / render-link-autolink.html / render-link-autolink-extended.html.

Thank you for considering. :)

@bep
Copy link
Member

bep commented Jun 10, 2022

I would mind adding a ´LinkType`, some notes:

  • Currently both image links and ... other links receive the same struct (the same fields), so an image linke would also need a type
  • I don't the Markdown parser currently tells us if it is 2) or 3) above..

@bep bep modified the milestones: v0.101.0, v0.102.0 Jun 16, 2022
@bep bep modified the milestones: v0.102.0, v0.103.0 Aug 28, 2022
@bep bep modified the milestones: v0.103.0, v0.104.0 Sep 15, 2022
@bep bep modified the milestones: v0.104.0, v0.105.0 Sep 23, 2022
@bep bep modified the milestones: v0.105.0, v0.106.0 Oct 26, 2022
@bep bep modified the milestones: v0.106.0, v0.107.0 Nov 18, 2022
@bep bep modified the milestones: v0.107.0, v0.108.0 Dec 3, 2022
@bep bep modified the milestones: v0.108.0, v0.109.0 Dec 14, 2022
@bep bep modified the milestones: v0.109.0, v0.111.0, v0.110.0 Jan 26, 2023
@bep bep removed this from the v0.111.0 milestone Feb 15, 2023
@bep bep added this to the v0.112.0 milestone Feb 15, 2023
@bep bep modified the milestones: v0.112.0, v0.113.0 Apr 15, 2023
@bep bep modified the milestones: v0.113.0, v0.115.0 Jun 13, 2023
@bep bep modified the milestones: v0.115.0, v0.116.0 Jun 30, 2023
@bep bep modified the milestones: v0.116.0, v0.117.0 Aug 1, 2023
@bep bep modified the milestones: v0.117.0, v0.118.0 Aug 30, 2023
@bep bep modified the milestones: v0.118.0, v0.119.0 Sep 15, 2023
@bep bep modified the milestones: v0.119.0, v0.120.0 Oct 5, 2023
@bep bep modified the milestones: v0.120.0, v0.121.0 Oct 31, 2023
@bep bep modified the milestones: v0.121.0, v0.122.0 Dec 6, 2023
@bep bep modified the milestones: v0.122.0, v0.123.0, v0.124.0 Jan 27, 2024
@bep bep modified the milestones: v0.124.0, v0.125.0 Mar 4, 2024
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

3 participants