comment.Printer.DocLinkURL isn't being called

67 views
Skip to first unread message

will....@gmail.com

unread,
Jul 9, 2023, 6:45:45 PM7/9/23
to golang-nuts
I'm trying to print the Markdown for package documentation using the new go/doc/comment package. It seems like I have everything set up correctly to customize the doc link URLs, but the comment.Printer.DocLinkURL callback isn't being called:


The comment.Printer.HeadingID and HeadingLevel settings are working just fine.

Am I missing something?

Sean Liao

unread,
Jul 9, 2023, 8:10:08 PM7/9/23
to golang-nuts
your parsing setup is missing the lookup to identify which things are actually linkable symbols


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/41ce3de2-84a4-47a3-856d-0bc4543115fbn%40googlegroups.com.

will....@gmail.com

unread,
Jul 9, 2023, 8:55:02 PM7/9/23
to golang-nuts
Thanks, that was it!

will....@gmail.com

unread,
Jul 9, 2023, 9:10:22 PM7/9/23
to golang-nuts
The documentation for comment.Parser.LookupSym is unclear. When would you ever not return true?

Looking at Parser more, it isn't clear how you'd implement comment.Parser.LookupPackage in a general way. Has that been done somewhere?

I don't see a way to disable links to declarations entirely, so `[MyType]` doc syntax is rendered in Markdown as just `MyType` instead of `\[MyType]`. Is there a way to do that?
Reply all
Reply to author
Forward
0 new messages