Skip to content

Commit

Permalink
Have level-2 headings appear in upper-case in man pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Jan 2, 2019
1 parent fde295f commit 545badc
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions md2roff/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"regexp"
"strconv"
"strings"

"github.com/russross/blackfriday"
)
Expand Down Expand Up @@ -174,15 +175,10 @@ func (r *RoffRenderer) renderHeading(buf io.Writer, node *blackfriday.Node) {
)
io.WriteString(buf, ".nh\n") // disable hyphenation
io.WriteString(buf, ".ad l\n") // disable justification
case 2, 3:
var ht string
switch node.HeadingData.Level {
case 2:
ht = ".SH"
case 3:
ht = ".SS"
}
fmt.Fprintf(buf, "%s \"%s\"\n", ht, escape(text, headingEscape))
case 2:
fmt.Fprintf(buf, ".SH \"%s\"\n", strings.ToUpper(string(escape(text, headingEscape))))
case 3:
fmt.Fprintf(buf, ".SS \"%s\"\n", escape(text, headingEscape))
}
}

Expand Down

0 comments on commit 545badc

Please sign in to comment.