gomarkdoc icon indicating copy to clipboard operation
gomarkdoc copied to clipboard

support new godoc spec enforced by gofmt

Open jeffatgametime opened this issue 3 years ago • 1 comments

gofmt has a new # syntax for inferred headers. see release notes https://go.dev/doc/go1.19#go-doc.

support this by not escaping headers beginning with # in godoc.

example

example.go

// Package example ...
//
// # Documentation
// 
// documentation...
package example

results in markdown with the header's # escaped

README.go

...
\# Documentation
...

jeffatgametime avatar Sep 23 '22 15:09 jeffatgametime

Just FYI: The go/doc/comment.Printer includes a Markdown method that formats the new godoc comments as Markdown. This may ease the implementation on gomarkdoc.

abhinav avatar Oct 28 '22 22:10 abhinav

I gave it a shot and tried to implement @abhinav suggestion.

While my PR is being reviewed, you can give it a try with

go run github.com/phsym/gomarkdoc/cmd/gomarkdoc@latest

phsym avatar Dec 16 '22 16:12 phsym

Hi all, thanks for opening this issue and working through possible solutions. The go 1.19 language support was a while in the making but is now available as part of the latest release (via #86, #87 and #89). Please try updating and open new issues for anything you encounter that is still broken with the latest code.

princjef avatar Jun 12 '23 01:06 princjef