man: vendor github.com/cpuguy83/go-md2man/v2 v2.0.6

full diff: https://github.com/cpuguy83/go-md2man/compare/v2.0.5...v2.0.6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-01-26 21:40:10 +01:00
parent 433e9a50ce
commit 4e6535fd3e
6 changed files with 22 additions and 14 deletions

View File

@@ -2,6 +2,6 @@ module github.com/docker/docker/man
go 1.19
require github.com/cpuguy83/go-md2man/v2 v2.0.5
require github.com/cpuguy83/go-md2man/v2 v2.0.6
require github.com/russross/blackfriday/v2 v2.1.0 // indirect

View File

@@ -1,4 +1,4 @@
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=

View File

@@ -3,13 +3,12 @@ go-md2man
Converts markdown into roff (man pages).
Uses blackfriday to process markdown into man pages.
Uses [blackfriday](https://github.com/russross/blackfriday) to process markdown into man pages.
### Usage
./md2man -in /path/to/markdownfile.md -out /manfile/output/path
```bash
go install github.com/cpuguy83/go-md2man@latest
### How to contribute
We use go modules to manage dependencies.
As such you must be using at lest go1.11.
go-md2man -in /path/to/markdownfile.md -out /manfile/output/path
```

View File

@@ -3,7 +3,7 @@ package main
import (
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"github.com/cpuguy83/go-md2man/v2/md2man"
@@ -28,7 +28,7 @@ func main() {
}
defer inFile.Close() // nolint: errcheck
doc, err := io.ReadAll(inFile)
doc, err := ioutil.ReadAll(inFile)
if err != nil {
fmt.Println(err)
os.Exit(1)

View File

@@ -104,7 +104,7 @@ func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering
node.Parent.Prev.Type == blackfriday.Heading &&
node.Parent.Prev.FirstChild != nil &&
bytes.EqualFold(node.Parent.Prev.FirstChild.Literal, []byte("NAME")) {
before, after, found := bytes.Cut(node.Literal, []byte(" - "))
before, after, found := bytesCut(node.Literal, []byte(" - "))
escapeSpecialChars(w, before)
if found {
out(w, ` \- `)
@@ -406,3 +406,12 @@ func escapeSpecialCharsLine(w io.Writer, text []byte) {
w.Write([]byte{'\\', text[i]}) // nolint: errcheck
}
}
// bytesCut is a copy of [bytes.Cut] to provide compatibility with go1.17
// and older. We can remove this once we drop support for go1.17 and older.
func bytesCut(s, sep []byte) (before, after []byte, found bool) {
if i := bytes.Index(s, sep); i >= 0 {
return s[:i], s[i+len(sep):], true
}
return s, nil, false
}

View File

@@ -1,5 +1,5 @@
# github.com/cpuguy83/go-md2man/v2 v2.0.5
## explicit; go 1.11
# github.com/cpuguy83/go-md2man/v2 v2.0.6
## explicit; go 1.12
github.com/cpuguy83/go-md2man/v2
github.com/cpuguy83/go-md2man/v2/md2man
# github.com/russross/blackfriday/v2 v2.1.0