4

According to the "Godoc: documenting Go code" blog post:

URLs will be converted to HTML links; no special markup is necessary.

However, is there a way to create an HTML link with different link text than the URL?

Matthew Rankin
  • 457,139
  • 39
  • 126
  • 163

1 Answers1

4

Go 1.19 introduced a format for specifying the link text. The link text is written inline between square brackets: [Link Text]. The link target is specified on a separate line like this:

[Link Text]: https://example.com/link/target

See the Go Doc Comment documentation for the complete details.


Answer for Go 1.18 and earlier:

Godoc.org linkifies text like "RFC 1234" to the online RFC (example here).

With that exception, the godoc tool and godoc.org do not provide a way to use text different from the URL.

Charlie Tumahai
  • 113,709
  • 12
  • 249
  • 242