muesli/roff

roff lets you write roff documents in Go

Go

58

23 commits

updated Aug 18, 2026

See the code

README

roff

Latest Release Software License Build Status Coverage Status Go Doc

roff lets you write roff documents in Go

Tutorial

Import the library:

import "github.com/muesli/roff"

Then start a new roff document and write to it:

doc := roff.NewDocument()
doc.Heading(1, "Title", "A short description", time.Now())

// a section of text
doc.Section("Introduction")
doc.Text("Here is a quick introduction to writing roff documents with Go!")

// fonts
doc.Section("Fonts")
doc.Text("This is a text with a bold font: ")
doc.TextBold("I am bold!")
doc.Paragraph()
doc.Text("This is a text with an italic font: ")
doc.TextItalic("I am italic!")

// indentation
doc.Section("Indentation")
doc.Text("This block of text is left-aligned to the section.")
doc.Indent(4)
doc.Text("This block of text is totally indented.")
doc.IndentEnd()
doc.Text("... left-aligned again!")

// lists
doc.Section("Lists")
doc.Text("A list:")
doc.Paragraph()
doc.Indent(4)
doc.List("First list item")
doc.List("Second list item")

Fetch the roff document as a string and you're done:

fmt.Println(doc.String())

Feedback

Got some feedback or suggestions? Please open an issue or drop me a note!

Significant stargazers

Christian Rocha

1,228 followers · starred Jan 2022

muesli/roff

roff lets you write roff documents in Go

Go

58

23 commits

updated Aug 18, 2026

See the code

README

roff

Latest Release Software License Build Status Coverage Status Go Doc

roff lets you write roff documents in Go

Tutorial

Import the library:

import "github.com/muesli/roff"

Then start a new roff document and write to it:

doc := roff.NewDocument()
doc.Heading(1, "Title", "A short description", time.Now())

// a section of text
doc.Section("Introduction")
doc.Text("Here is a quick introduction to writing roff documents with Go!")

// fonts
doc.Section("Fonts")
doc.Text("This is a text with a bold font: ")
doc.TextBold("I am bold!")
doc.Paragraph()
doc.Text("This is a text with an italic font: ")
doc.TextItalic("I am italic!")

// indentation
doc.Section("Indentation")
doc.Text("This block of text is left-aligned to the section.")
doc.Indent(4)
doc.Text("This block of text is totally indented.")
doc.IndentEnd()
doc.Text("... left-aligned again!")

// lists
doc.Section("Lists")
doc.Text("A list:")
doc.Paragraph()
doc.Indent(4)
doc.List("First list item")
doc.List("Second list item")

Fetch the roff document as a string and you're done:

fmt.Println(doc.String())

Feedback

Got some feedback or suggestions? Please open an issue or drop me a note!

Significant stargazers

Christian Rocha

1,228 followers · starred Jan 2022