Skip to content

Commit

Permalink
Merge pull request #95 from kolyshkin/example
Browse files Browse the repository at this point in the history
Use .EX/.EE to typeset code blocks
  • Loading branch information
cpuguy83 authored Apr 27, 2023
2 parents 31a4ffb + 43fb747 commit aab1666
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
27 changes: 16 additions & 11 deletions go-md2man.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@ go-md2man 1 "January 2015" go-md2man "User Manual"
==================================================

# NAME
go-md2man - Convert markdown files into manpages
go-md2man - Convert markdown files into manpages

# SYNOPSIS
go-md2man -in=[/path/to/md/file] -out=[/path/to/output]
**go-md2man** [**-in**=*/path/to/md/file*] [**-out**=*/path/to/output*]

# Description
go-md2man converts standard markdown formatted documents into manpages. It is
written purely in Go so as to reduce dependencies on 3rd party libs.
# DESCRIPTION
**go-md2man** converts standard markdown formatted documents into manpages. It is
written purely in Go so as to reduce dependencies on 3rd party libs.

By default, the input is stdin and the output is stdout.
By default, the input is stdin and the output is stdout.

# Example
Convert the markdown file "go-md2man.1.md" into a manpage.
# EXAMPLES
Convert the markdown file *go-md2man.1.md* into a manpage:
```
go-md2man < go-md2man.1.md > go-md2man.1
```

go-md2man -in=go-md2man.1.md -out=go-md2man.1.out
Same, but using command line arguments instead of shell redirection:
```
go-md2man -in=go-md2man.1.md -out=go-md2man.1
```

# HISTORY
January 2015, Originally compiled by Brian Goff( cpuguy83@gmail.com )

January 2015, Originally compiled by Brian Goff (cpuguy83@gmail.com).
4 changes: 2 additions & 2 deletions md2man/roff.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const (
linkCloseTag = "\\[ra]"
codespanTag = "\\fB\\fC"
codespanCloseTag = "\\fR"
codeTag = "\n.PP\n.RS\n\n.nf\n"
codeCloseTag = "\n.fi\n.RE\n"
codeTag = "\n.EX\n"
codeCloseTag = "\n.EE\n"
quoteTag = "\n.PP\n.RS\n"
quoteCloseTag = "\n.RE\n"
listTag = "\n.RS\n"
Expand Down
11 changes: 11 additions & 0 deletions md2man/roff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ type TestParams struct {
extensions blackfriday.Extensions
}

func TestCodeBlocks(t *testing.T) {
tests := []string{
"```\nsome code\n```\n",
".nh\n\n.EX\nsome code\n\n.EE\n",

"```bash\necho foo\n```\n",
".nh\n\n.EX\necho foo\n\n.EE\n",
}
doTestsParam(t, tests, TestParams{blackfriday.FencedCode})
}

func TestEmphasis(t *testing.T) {
tests := []string{
"nothing inline\n",
Expand Down

0 comments on commit aab1666

Please sign in to comment.