Skip to content

Render hooks for custom formatting of links #19

@mntn-xyz

Description

@mntn-xyz

This may not be possible without ugly hacks, but I wanted to generate some discussion around it since it would be a useful feature.

There are some sites that publish on both Gemini and the web. If I am linking to such a blog from the web, I'll probably use the web link. If I'm linking from Gemini, I probably want to use the Gemini link. I wonder if there's any way to provide both links in such a way that the Hugo renderer will output the HTTP(S) link while gmnhg will output the Gemini link.

I looked at attributes, but they can't yet be applied to links in Commonmark (goldmark) or blackfriday (gomarkdown), although there has been discussion about it: see commonmark/commonmark-spec#105 and russross/blackfriday#181

The one thing that is supported by both Commonmark and blackfriday, and appears to be supported in gomarkdown, is the "title" attribute. I suppose that could be abused to hold an alternate Gemini link, and on the Hugo side a custom link template (layouts/_default/_markup/render-link.html) could be used to ignore that attribute entirely. But this feels wrong.

Here's what it would look like:

[My wish-list for the next YAML](https://drewdevault.com/2021/07/28/The-next-YAML.html "gemini://drewdevault.com/2021/07/28/The-next-YAML.gmi")

I don't think that the markup looks so bad, it's just that the abuse of the title attribute feels dirty. And of course there must be someone out there who uses the title attribute for legitimate purposes.

Any thoughts on a better approach for this? Or is this best shelved for some future date when link attributes are available?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgmnhgIssue related to cmd/gmnhgmajorRequires a major refactoring or rewriterendererIssue related to the Gemtext renderer

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions