go-md2man - 转换 Markdown 为 man 手册内容

go-md2man

Converts markdown into roff (man pages).

Uses blackfriday to process markdown into man pages.

Usage

./md2man -in /path/to/markdownfile.md -out /manfile/output/path

How to contribute

We use go modules to manage dependencies. As such you must be using at lest go1.11.

Comments
  • Curly braces not escaped

    Curly braces not escaped

    On my shiny Ubuntu machine with a docker 1.6 install, man docker inspect reads as follows:

    Getting the IP address of a container instance
           To get the IP address of a container use:
    
                  # docker inspect --format='.NetworkSettings.IPAddress' 1eb5fabf5a03
                  172.17.0.2
    

    For comparison, here is the markdown source that generated that; note the curly braces in the original.

  • Build / dependencies broken

    Build / dependencies broken

    I'm using spf13/cobra/doc which depends on this module. Running go get -u I'm seing the following errors:

    # github.com/cpuguy83/go-md2man/md2man
    ../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:11:16: undefined: blackfriday.EXTENSION_NO_INTRA_EMPHASIS
    ../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:12:16: undefined: blackfriday.EXTENSION_TABLES
    ../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:13:16: undefined: blackfriday.EXTENSION_FENCED_CODE
    ../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:14:16: undefined: blackfriday.EXTENSION_AUTOLINK
    ../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:15:16: undefined: blackfriday.EXTENSION_SPACE_HEADERS
    ../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:16:16: undefined: blackfriday.EXTENSION_FOOTNOTES
    ../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:17:16: undefined: blackfriday.EXTENSION_TITLEBLOCK
    ../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:19:29: too many arguments to conversion to blackfriday.Markdown: blackfriday.Markdown(doc, renderer, extensions)
    ../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:19:9: cannot use &roffRenderer literal (type *roffRenderer) as type blackfriday.Renderer in return argument:
            *roffRenderer does not implement blackfriday.Renderer (missing RenderFooter method)
    ../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:102:11: undefined: blackfriday.LIST_TYPE_ORDERED
    ../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:102:11: too many errors
    
  • blackfriday version issue

    blackfriday version issue

    my golang env:

    go 1.13.5
    
    

    when I run

    
    go get -u github.com/swaggo/swag/cmd/swag
    
    

    the CLI tool output:

    D:\tools\GoPath\pkg\mod\github.com\cpuguy83\[email protected]\md2man\md2man.go:11:16: undefined: blackfriday.EXTENSION_NO_INTRA_EMPHASIS
    D:\tools\GoPath\pkg\mod\github.com\cpuguy83\[email protected]\md2man\md2man.go:12:16: undefined: blackfriday.EXTENSION_TABLES
    D:\tools\GoPath\pkg\mod\github.com\cpuguy83\[email protected]\md2man\md2man.go:13:16: undefined: blackfriday.EXTENSION_FENCED_CODE
    D:\tools\GoPath\pkg\mod\github.com\cpuguy83\[email protected]\md2man\md2man.go:14:16: undefined: blackfriday.EXTENSION_AUTOLINK
    D:\tools\GoPath\pkg\mod\github.com\cpuguy83\[email protected]\md2man\md2man.go:15:16: undefined: blackfriday.EXTENSION_SPACE_HEADERS
    D:\tools\GoPath\pkg\mod\github.com\cpuguy83\[email protected]\md2man\md2man.go:16:16: undefined: blackfriday.EXTENSION_FOOTNOTES
    D:\tools\GoPath\pkg\mod\github.com\cpuguy83\[email protected]\md2man\md2man.go:17:16: undefined: blackfriday.EXTENSION_TITLEBLOCK
    D:\tools\GoPath\pkg\mod\github.com\cpuguy83\[email protected]\md2man\md2man.go:19:29: too many arguments to conversion to blackfriday.Markdown: blackfriday.Markdown(doc, renderer, extensions)
    D:\tools\GoPath\pkg\mod\github.com\cpuguy83\[email protected]\md2man\roff.go:19:9: cannot use &roffRenderer literal (type *roffRenderer) as type blackfriday.Renderer in return argument:
            *roffRenderer does not implement blackfriday.Renderer (missing RenderFooter method)
    D:\tools\GoPath\pkg\mod\github.com\cpuguy83\[email protected]\md2man\roff.go:102:11: undefined: blackfriday.LIST_TYPE_ORDERED
    D:\tools\GoPath\pkg\mod\github.com\cpuguy83\[email protected]\md2man\roff.go:102:11: too many errors
    
    

    I thinkthis line should be:

    
    github.com/russross/blackfriday v1.5.2
    

    Or, you may need update this repo.

  • Can we get this updated for blackfriday v2 and/or get a go.mod?

    Can we get this updated for blackfriday v2 and/or get a go.mod?

    If you're using cobra with modules, a go get will end up getting blackfriday v2, which is not compatible with this library. Therefore, you have to manually push blackfriday back to v1.5.2, which is annoying if you're doing a blanket update of your deps.

    Can we either:

    • Update this to blackfriday v2
    • Add a go.mod in this repository specifying the blackfriday v1 dependency

    It would be a huge help.

    Related:

    https://github.com/spf13/cobra/issues/805 https://github.com/cpuguy83/go-md2man/issues/42

  • Prob since update to Blackfriday V2

    Prob since update to Blackfriday V2

    This package is being used in spf13/cobra/docs to generate man pages.

    It seems that since commit revision 124c15a91abbd0570c8510ba7e5a22eecfb5ba86, the following error appears.

    vendor/github.com/cpuguy83/go-md2man/md2man/roff.go:15:15: undefined: blackfriday.Extensions

  • Runtime Error invalid memory...

    Runtime Error invalid memory...

     make  GOMD2MAN=~/bin/go-md2man 
    /home/dwalsh/bin/go-md2man -in buildah.md -out buildah.1
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4daf1b]
    
    goroutine 1 [running]:
    github.com/cpuguy83/go-md2man/md2man.(*roffRenderer).handleTableCell(0xc4200784b0, 0x5b14e0, 0xc4200dbb20, 0xc4200f2dc0, 0x201)
    	/home/dwalsh/go/src/github.com/cpuguy83/go-md2man/md2man/roff.go:269 +0x5b
    github.com/cpuguy83/go-md2man/md2man.(*roffRenderer).RenderNode(0xc4200784b0, 0x5b14e0, 0xc4200dbb20, 0xc4200f2dc0, 0x1, 0x0)
    	/home/dwalsh/go/src/github.com/cpuguy83/go-md2man/md2man/roff.go:156 +0x66c
    github.com/cpuguy83/go-md2man/vendor/github.com/russross/blackfriday.Run.func1(0xc4200f2dc0, 0x4d9e01, 0x0)
    	/home/dwalsh/go/src/github.com/cpuguy83/go-md2man/vendor/github.com/russross/blackfriday/markdown.go:392 +0x5a
    github.com/cpuguy83/go-md2man/vendor/github.com/russross/blackfriday.(*Node).Walk(0xc4200b0500, 0xc4200d7e18)
    	/home/dwalsh/go/src/github.com/cpuguy83/go-md2man/vendor/github.com/russross/blackfriday/node.go:284 +0x56
    github.com/cpuguy83/go-md2man/vendor/github.com/russross/blackfriday.Run(0xc4200e6000, 0x1110, 0x1e00, 0xc4200d7e98, 0x2, 0x2, 0xc42000c050, 0x200, 0xc4200e6000)
    	/home/dwalsh/go/src/github.com/cpuguy83/go-md2man/vendor/github.com/russross/blackfriday/markdown.go:391 +0x281
    github.com/cpuguy83/go-md2man/md2man.Render(0xc4200e6000, 0x1110, 0x1e00, 0x1110, 0x1e00, 0x0)
    	/home/dwalsh/go/src/github.com/cpuguy83/go-md2man/md2man/md2man.go:11 +0xdc
    main.main()
    	/home/dwalsh/go/src/github.com/cpuguy83/go-md2man/md2man.go:35 +0x143
    make: *** [Makefile:9: buildah.1] Error 2
    
  • Do not escape dash, underscore, and ampersand

    Do not escape dash, underscore, and ampersand

    Currently, we escape a few characters, such as

    • - (dash) becomes \- (arithmetic minus sign)
    • _ (underscore) becomes \_ (underline character)
    • & (ampersand) becomes \& (zero-width space!)

    As a result, we have two bugs:

    1. All & characters disappear from the resulting man page.

    2. Dashes are quite longer, and underscores becomes underlines (the latter are lower). This is not reflected in text output, only in PDF etc, and in most cases (like file names, command line options etc) does not look good.

    In fact, the only character that needs escaping is the backslash itself. This is what this patch does, together with fixes to expected test output.

    The following commands were used to generate the example PDFs:

    $ bin/go-md2man < go-md2man.1.md > go-md2man.1
    $ man -Tpdf ./go-md2man.1 > go-md2man.pdf
    

    Before: go-md2man-old.pdf

    After: go-md2man.pdf

    Visual comparison: Screenshot from 2021-07-13 14-30-22

    Source for the above:

    .PP
    .RS
    
    .nf
    Old: go\-md2man \-\-example \-in=go\-md2man.1.md \-out=go\-md2man.1.out
    New: go-md2man --example -in=go-md2man.1.md -out=go-md2man.1.out
    
    Old: \-\-\- \_\_\_ \&\&\& k\_p\_q\_\_y\_z
    New: --- ___ &&& k_p_q__y_z
    .fi
    .RE
    
  • glide install error

    glide install error

    glide install it depend go-md2man ,and shows :

    Error scanning github.com/cpuguy83/go-md2man/v2/md2man: cannot find package "." in:
            /Users/xxxx/.glide/cache/src/https-github.com-cpuguy83-go-md2man/v2/md2man
    

    it seems need go mod , I update go to go1.13 ,it still install err ,what can I do can avoid "github.com/cpuguy83/go-md2man/v2/md2man" import error ? thanks

  • Update to Blackfriday v2 API

    Update to Blackfriday v2 API

    My initial attempt at migrating go-md2man to use the v2 API and add support for "definition lists" which make argument/option listings more like traditional manpages (IMHO). Working on containerd man pages was the impetus for this :)

    I would like to add a test for all the features claimed to be supported here with a example input and verified output before calling this complete. But, it is working for simple manpage tests I've performed so far.

    Closes #28

  • General cleanup

    General cleanup

    • Add documentation surrounding building and using md2man.
    • Modify the dockerfile so that a version is included that can be used for development.
    • Add a -v version flag.
    • Error when the input file/stdin is zero-length
    • Send errors to stderr.
    • Add support for running tests via travis-ci.
  • `go install` not working as expected

    `go install` not working as expected

    It is not possible to use go install to have latest go-md2man installed :(

    Using go install from Go 1.18 to install go-md2man, I see some strange results.

    1. By default, @latest installs v1.0.10, not v2.0.1.
    [kir@kir-rhat ~]$ go install -v -x  github.com/cpuguy83/go-md2man@latest
    # get https://proxy.golang.org/github.com/@v/list
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/list
    # get https://proxy.golang.org/github.com/cpuguy83/@v/list
    # get https://proxy.golang.org/github.com/cpuguy83/@v/list: 410 Gone (0.110s)
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/list: 200 OK (0.116s)
    # get https://proxy.golang.org/github.com/@v/list: 410 Gone (0.117s)
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/v1.0.10.info
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/v1.0.10.info: 200 OK (0.014s)
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/v1.0.10.mod
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/v1.0.10.mod: 200 OK (0.017s)
    # get https://proxy.golang.org/sumdb/sum.golang.org/supported
    # get https://proxy.golang.org/sumdb/sum.golang.org/supported: 410 Gone (0.015s)
    # get https://sum.golang.org/tile/8/0/x038/464.p/109
    # get https://sum.golang.org/tile/8/2/000.p/150
    # get https://sum.golang.org/tile/8/1/150.p/64
    # get https://sum.golang.org/tile/8/1/150.p/64: 200 OK (0.126s)
    # get https://sum.golang.org/tile/8/0/x038/464.p/109: 200 OK (0.128s)
    # get https://sum.golang.org/tile/8/2/000.p/150: 200 OK (0.135s)
    # get https://sum.golang.org/lookup/github.com/cpuguy83/[email protected]
    # get https://sum.golang.org/lookup/github.com/cpuguy83/[email protected]: 200 OK (0.014s)
    # get https://sum.golang.org/tile/8/0/013
    # get https://sum.golang.org/tile/8/1/000
    # get https://sum.golang.org/tile/8/0/013: 200 OK (0.014s)
    # get https://sum.golang.org/tile/8/1/000: 200 OK (0.016s)
    go: downloading github.com/cpuguy83/go-md2man v1.0.10
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/v1.0.10.zip
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/v1.0.10.zip: 200 OK (0.019s)
    # get https://proxy.golang.org/github.com/russross/blackfriday/@v/v1.5.2.mod
    # get https://proxy.golang.org/github.com/russross/blackfriday/@v/v1.5.2.mod: 200 OK (0.017s)
    # get https://sum.golang.org/lookup/github.com/russross/[email protected]
    # get https://sum.golang.org/lookup/github.com/russross/[email protected]: 200 OK (0.018s)
    # get https://sum.golang.org/tile/8/0/001
    # get https://sum.golang.org/tile/8/0/001: 200 OK (0.017s)
    go: downloading github.com/russross/blackfriday v1.5.2
    # get https://proxy.golang.org/github.com/russross/blackfriday/@v/v1.5.2.zip
    # get https://proxy.golang.org/github.com/russross/blackfriday/@v/v1.5.2.zip: 200 OK (0.014s)
    # get https://proxy.golang.org/github.com/russross/blackfriday/@v/v1.5.2.info
    # get https://proxy.golang.org/github.com/russross/blackfriday/@v/v1.5.2.info: 200 OK (0.019s)
    WORK=/tmp/go-build3425548627
    github.com/russross/blackfriday
    mkdir -p $WORK/b045/
    cat >$WORK/b045/importcfg << 'EOF' # internal
    # import config
    packagefile bytes=/home/kir/sdk/go1.18/pkg/linux_amd64/bytes.a
    packagefile fmt=/home/kir/sdk/go1.18/pkg/linux_amd64/fmt.a
    packagefile regexp=/home/kir/sdk/go1.18/pkg/linux_amd64/regexp.a
    packagefile strconv=/home/kir/sdk/go1.18/pkg/linux_amd64/strconv.a
    packagefile strings=/home/kir/sdk/go1.18/pkg/linux_amd64/strings.a
    packagefile unicode=/home/kir/sdk/go1.18/pkg/linux_amd64/unicode.a
    packagefile unicode/utf8=/home/kir/sdk/go1.18/pkg/linux_amd64/unicode/utf8.a
    EOF
    cd /home/kir
    ./sdk/go1.18/pkg/tool/linux_amd64/compile -o $WORK/b045/_pkg_.a -trimpath "$WORK/b045=>" -p github.com/russross/blackfriday -lang=go1.16 -complete -buildid 0vcZLU3osy8Ia58Ojzmy/0vcZLU3osy8Ia58Ojzmy -goversion go1.18 -c=4 -nolocalimports -importcfg $WORK/b045/importcfg -pack ./go/pkg/mod/github.com/russross/[email protected]/block.go ./go/pkg/mod/github.com/russross/[email protected]/doc.go ./go/pkg/mod/github.com/russross/[email protected]/html.go ./go/pkg/mod/github.com/russross/[email protected]/inline.go ./go/pkg/mod/github.com/russross/[email protected]/latex.go ./go/pkg/mod/github.com/russross/[email protected]/markdown.go ./go/pkg/mod/github.com/russross/[email protected]/smartypants.go
    /home/kir/sdk/go1.18/pkg/tool/linux_amd64/buildid -w $WORK/b045/_pkg_.a # internal
    cp $WORK/b045/_pkg_.a /home/kir/.cache/go-build/13/13048e2972b277fc5d62ad42ad5aceb8887825948e956a162fe358e20910bd68-d # internal
    github.com/cpuguy83/go-md2man/md2man
    mkdir -p $WORK/b043/
    cat >$WORK/b043/importcfg << 'EOF' # internal
    # import config
    packagefile bytes=/home/kir/sdk/go1.18/pkg/linux_amd64/bytes.a
    packagefile fmt=/home/kir/sdk/go1.18/pkg/linux_amd64/fmt.a
    packagefile github.com/russross/blackfriday=$WORK/b045/_pkg_.a
    packagefile html=/home/kir/sdk/go1.18/pkg/linux_amd64/html.a
    packagefile strings=/home/kir/sdk/go1.18/pkg/linux_amd64/strings.a
    EOF
    ./sdk/go1.18/pkg/tool/linux_amd64/compile -o $WORK/b043/_pkg_.a -trimpath "$WORK/b043=>" -p github.com/cpuguy83/go-md2man/md2man -lang=go1.12 -complete -buildid IYWFJkyd3N6Fr0N9cZJm/IYWFJkyd3N6Fr0N9cZJm -goversion go1.18 -c=4 -nolocalimports -importcfg $WORK/b043/importcfg -pack ./go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go ./go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go
    /home/kir/sdk/go1.18/pkg/tool/linux_amd64/buildid -w $WORK/b043/_pkg_.a # internal
    cp $WORK/b043/_pkg_.a /home/kir/.cache/go-build/d2/d2d28bf2e7269051b8e0d584c13a89917647a1a2f109dacf1a39979a356ebb4f-d # internal
    
    1. If v2 is explicitly specified, it does not work (I guess this is due to lack of v2 tag; maybe not):
    [kir@kir-rhat ~]$ go install -v -x  github.com/cpuguy83/go-md2man@v2
    # get https://proxy.golang.org/github.com/@v/list
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/list
    # get https://proxy.golang.org/github.com/cpuguy83/@v/list
    # get https://proxy.golang.org/github.com/@v/list: 410 Gone (0.207s)
    # get https://proxy.golang.org/github.com/cpuguy83/@v/list: 410 Gone (0.224s)
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/list: 200 OK (0.228s)
    go: github.com/cpuguy83/go-md2man@v2: no matching versions for query "v2"
    
    1. It is not possible to install either v2.0.0 or v2.0.1:
    [kir@kir-rhat ~]$ go install github.com/cpuguy83/[email protected]
    go: github.com/cpuguy83/[email protected]: github.com/cpuguy83/[email protected]: invalid version: go.mod has post-v2 module path "github.com/cpuguy83/go-md2man/v2" at revision v2.0.0
    

    Same with more output:

    [kir@kir-rhat ~]$ go install -v -x  github.com/cpuguy83/[email protected]
    # get https://proxy.golang.org/github.com/@v/v2.0.0.info
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/v2.0.0.info
    # get https://proxy.golang.org/github.com/cpuguy83/@v/v2.0.0.info
    # get https://proxy.golang.org/github.com/cpuguy83/@v/v2.0.0.info: 410 Gone (0.104s)
    # get https://proxy.golang.org/github.com/@v/v2.0.0.info: 410 Gone (0.111s)
    # get https://proxy.golang.org/github.com/cpuguy83/go-md2man/@v/v2.0.0.info: 410 Gone (0.114s)
    mkdir -p /home/kir/go/pkg/mod/cache/vcs # git3 https://github.com/cpuguy83/go-md2man
    # lock /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0.lockmkdir -p /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0 # git3 https://github.com/cpuguy83/go-md2man
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git init --bare
    0.008s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git init --bare
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git remote add origin -- https://github.com/cpuguy83/go-md2man
    0.005s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git remote add origin -- https://github.com/cpuguy83/go-md2man
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git tag -l
    0.006s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git tag -l
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git ls-remote -q origin
    0.462s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git ls-remote -q origin
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' f79a8a8ca69da163eee19ab442bedad7a35bba5a --
    0.005s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' f79a8a8ca69da163eee19ab442bedad7a35bba5a --
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git fetch -f --depth=1 origin refs/tags/v2.0.0:refs/tags/v2.0.0
    0.706s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git fetch -f --depth=1 origin refs/tags/v2.0.0:refs/tags/v2.0.0
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' refs/tags/v2.0.0 --
    0.005s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' refs/tags/v2.0.0 --
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 7762f7e404f8416dfa1d9bb6a8c192aa9acb4d19 --
    0.004s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 7762f7e404f8416dfa1d9bb6a8c192aa9acb4d19 --
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git fetch -f --depth=1 origin refs/tags/v1.0.10:refs/tags/v1.0.10
    0.773s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git fetch -f --depth=1 origin refs/tags/v1.0.10:refs/tags/v1.0.10
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' refs/tags/v1.0.10 --
    0.005s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' refs/tags/v1.0.10 --
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git cat-file blob 7762f7e404f8416dfa1d9bb6a8c192aa9acb4d19:go.mod
    0.004s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git cat-file blob 7762f7e404f8416dfa1d9bb6a8c192aa9acb4d19:go.mod
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git cat-file blob 7762f7e404f8416dfa1d9bb6a8c192aa9acb4d19:go.mod
    0.005s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git cat-file blob 7762f7e404f8416dfa1d9bb6a8c192aa9acb4d19:go.mod
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git cat-file blob f79a8a8ca69da163eee19ab442bedad7a35bba5a:go.mod
    0.004s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git cat-file blob f79a8a8ca69da163eee19ab442bedad7a35bba5a:go.mod
    cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git cat-file blob f79a8a8ca69da163eee19ab442bedad7a35bba5a:go.mod
    0.003s # cd /home/kir/go/pkg/mod/cache/vcs/af686cb350700dd71341e2df4d234a7ecf75459b3ee587660c6d179152b68ea0; git cat-file blob f79a8a8ca69da163eee19ab442bedad7a35bba5a:go.mod
    go: github.com/cpuguy83/[email protected]: github.com/cpuguy83/[email protected]: invalid version: go.mod has post-v2 module path "github.com/cpuguy83/go-md2man/v2" at revision v2.0.0
    
  • Handle <br> inside <dl>

    Handle
    inside

    The following input (instead of <br>, two spaces can also be used):

    **ADD_IMAGE_EXCLUDES**=*"/etc/ltsp/add-image.excludes"*<br>
    **OMIT_IMAGE_EXCLUDES**=*"home/\*"*
    :   Add or omit items to the `ltsp image` exclusion list.
    

    gives a completely messed up output, with some parts missing and some other parts getting duplicated:

    .TP
    \fBOMIT_IMAGE_EXCLUDES\fP=\fI"home/*"\fP
    Add or omit items to the \fB\fCltsp image\fR exclusion list.
    
    .PP
    Add or omit items to the \fB\fCltsp image\fR exclusion list.
    

    To work around this, currently I'm using sed to change the initial markdown code to:

    **ADD_IMAGE_EXCLUDES**=*"/etc/ltsp/add-image.excludes"*
    :
    
    **OMIT_IMAGE_EXCLUDES**=*"home/\*"*
    :   Add or omit items to the `ltsp image` exclusion list.
    
    

    With a bit of pre-processing and post-processing and special casing, go-md2man produces nice output! We'll switch to that again for ltsp.org, thank you!

  • Don't duplicate <url>

    Don't duplicate

    With this input:

    <https://ltsp.org>
    

    this output is produced:

    https://ltsp.org
    \[la]https://ltsp.org\[ra]
    

    That would make sense for the [text](url) syntax, but it doesn't make sense for the <url> syntax where the text is the link itself. There's no need to see it twice.

    Ronn produces this instead:

    \fIhttps://ltsp\.org\fR
    

    Pandoc produces this instead:

    <https://ltsp.org>
    

    Both of them are acceptable. Thank you!

  • Behave more like a regular POSIX utility

    Behave more like a regular POSIX utility

    Don't close stdin, even at end-of-file. (Although this doesn't affect the code as it stands, it makes it brittle when incorporating into a larger program, where closing fd#0 could lead to it being reassigned to some other purpose.)

    When '-' is used as the input or output name, use stdin or stdout instead (in line with POSIX guidelines).

  • Add release script for GitHub Actions

    Add release script for GitHub Actions

    I'll be testing this to verify, but it's probably 99% correct. Generates a Windows and Linux amd64 binary, puts it in a tarball, creates a sha256 sum and uploads those 4 items to the release downloads. Would require that the release notes are attached to the signed tag so it can be pulled from there to make the release notes in the GH release page.

    Questions: do we want another binary for arm64 or anything else? It wouldn't be tested of course, and I guess the Windows one isn't being tested either. This could be simplified just to create and upload the amd64 Linux binary as well.

    Signed-off-by: Phil Estes [email protected]

  • Too many empty lines around ```code```

    Too many empty lines around ```code```

    For the LTSP5 package, we switched our manpage sources from .xml to .md and we started using go-md2man. After Debian Buster was released and its man pages went online, we noticed a problem.

    The man pages generated by go-md2man display fine when viewed under man. But when distributions use mandoc to publish them as .html pages online, a lot of empty lines are included in the html output, around the markdown code blocks (and I think elsewhere too).

    As an example, see our lts.conf man page, as produced by go-md2man and then published by Debian's mandoc: https://manpages.debian.org/unstable/ltsp-server/lts.conf.5.en.html

    Search for the following line, and see how many empty lines are around it: FSTAB_1="server:/home /home nfs defaults,nolock 0 0"

    Our previous lts.conf manpage, that wasn't using go-md2man, displays a lot less empty lines: https://manpages.debian.org/unstable/ltsp-docs/lts.conf.5.en.html

    Ronn also manages to convert our new markdown-based man pages without extra empty lines, so I believe it's an issue with go-md2man. Thanks!

Markdown - Markdown converter for golang

markdown ?? Talks ?? Join ?? Youtube ❤️ Sponsor Install via nami nami install ma

Jun 2, 2022
Mdfmt - A Markdown formatter that follow the CommonMark. Like gofmt, but for Markdown

Introduction A Markdown formatter that follow the CommonMark. Like gofmt, but fo

Dec 18, 2022
Blackfriday: a markdown processor for Go

Blackfriday Blackfriday is a Markdown processor implemented in Go. It is paranoid about its input (so you can safely feed it user-supplied data), it i

Jan 8, 2023
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.

html-to-markdown Convert HTML into Markdown with Go. It is using an HTML Parser to avoid the use of regexp as much as possible. That should prevent so

Jan 6, 2023
Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.
Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.

Tagify Gets STDIN, file or HTTP address as an input and returns a list of most popular words ordered by popularity as an output. More info about what

Dec 19, 2022
Upskirt markdown library bindings for Go

Goskirt Package goskirt provides Go-bindings for the excellent Sundown Markdown parser. (F/K/A Upskirt). To use goskirt, create a new Goskirt-value wi

Oct 23, 2022
A CLI markdown converter written in Go.

MDConv is a markdown converter written in Go. It is able to create PDF and HTML files from Markdown without using LaTeX. Instead MDConv u

Dec 20, 2022
A markdown renderer package for the terminal
A markdown renderer package for the terminal

go-term-markdown go-term-markdown is a go package implementing a Markdown renderer for the terminal. Note: Markdown being originally designed to rende

Nov 25, 2022
A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured.

goldmark A Markdown parser written in Go. Easy to extend, standards-compliant, well-structured. goldmark is compliant with CommonMark 0.29. Motivation

Dec 29, 2022
:triangular_ruler:gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt.
:triangular_ruler:gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt.

gofmtmd gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt. Installation $ go get github.com/po3rin/gofm

Oct 31, 2022
Convert Microsoft Word Document to Markdown
Convert Microsoft Word Document to Markdown

docx2md Convert Microsoft Word Document to Markdown Usage $ docx2md NewDocument.docx Installation $ go get github.com/mattn/docx2md Supported Styles

Jan 4, 2023
Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️
Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️

Glamour Write handsome command-line tools with Glamour. glamour lets you render markdown documents & templates on ANSI compatible terminals. You can c

Jan 1, 2023
A PDF renderer for the goldmark markdown parser.
A PDF renderer for the goldmark markdown parser.

goldmark-pdf goldmark-pdf is a renderer for goldmark that allows rendering to PDF. Reference See https://pkg.go.dev/github.com/stephenafamo/goldmark-p

Jan 7, 2023
Markdown to Webpage app

mark2web Markdown to webpage link Usage $ mark2web test.md https://mark2web.test/aa32d8f230ef9d44c3a7acb55b572c8599502701 $ mark2web /tmp/session/test

Apr 18, 2021
Markdown Powered Graph API

What is Arachne? Arachne, (Greek: “Spider”) in [[greek/mythology]], the [[Arachne:daughter of:Idmon of Colophon]] in Lydia, a dyer in purple. Arachne

Dec 19, 2021
Schedule daily tweets from markdown files in your repo, posted via github actions.

markdown-tweet-scheduler Schedule daily tweets from markdown files in your repo, posted to twitter via github actions. Setup Fork this repo Get your t

Dec 6, 2022
Hugo-to-Gemini Markdown converter

Hugo-to-Gemini converter This repo holds a converter of Hugo Markdown posts to text/gemini (also named Gemtext in this README). The converter is suppo

Nov 19, 2022
Parse data and test fixtures from markdown files, and patch them programmatically, too.

go-testmark Do you need test fixtures and example data for your project, in a language agnostic way? Do you want it to be easy to combine with documen

Oct 31, 2022
Automation Tool to auto generate markdown notes from online classes/talks/presentations.
Automation Tool to auto generate markdown notes from online classes/talks/presentations.

autonotes Automation tool to autocapture screenshots and join them with a supplied .srt or .txt file and output a notes file in markdown. Problem? Wat

Aug 29, 2021