gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt.
$ go get github.com/po3rin/gofmtmd/cmd/gofmtmd
# replace Go code with formated code
$ gofmtmd testdata/testdata.md -r
# write result to file instead of stdout
$ gofmtmd testdata/testdata.md -w formatted.md
# you can use stdndard input
$ gofmtmd < testdata/testdata.md
$ echo "#hello" | gofmtmd
$ gofmtmd -h
This CLI formats Go Code in Markdown.
Usage:
gofmtmd [flags]
Flags:
-h, --help help for gofmtmd
-r, --replace replace Go code with formated code
--version version for gofmtmd
-w, --write string write result to file instead of stdout
Vim plugin version is here! this plugin lets you to run automatically when saved.