1# roff
2
3[](https://github.com/muesli/roff/releases)
4[](https://github.com/muesli/roff/actions)
5[](https://coveralls.io/github/muesli/roff?branch=main)
6[](https://goreportcard.com/report/muesli/roff)
7[](https://pkg.go.dev/github.com/muesli/roff)
8
9roff lets you write roff documents in Go
10
11## Tutorial
12
13Import the library:
14
15```go
16import "github.com/muesli/roff"
17```
18
19Then start a new roff document and write to it:
20
21```go
22doc := roff.NewDocument()
23doc.Heading(1, "Title", "A short description", time.Now())
24
25// a section of text
26doc.Section("Introduction")
27doc.Text("Here is a quick introduction to writing roff documents with Go!")
28
29// fonts
30doc.Section("Fonts")
31doc.Text("This is a text with a bold font: ")
32doc.TextBold("I am bold!")
33doc.Paragraph()
34doc.Text("This is a text with an italic font: ")
35doc.TextItalic("I am italic!")
36
37// indentation
38doc.Section("Indentation")
39doc.Text("This block of text is left-aligned to the section.")
40doc.Indent(4)
41doc.Text("This block of text is totally indented.")
42doc.IndentEnd()
43doc.Text("... left-aligned again!")
44
45// lists
46doc.Section("Lists")
47doc.Text("A list:")
48doc.Paragraph()
49doc.Indent(4)
50doc.List("First list item")
51doc.List("Second list item")
52```
53
54Fetch the roff document as a string and you're done:
55
56```go
57fmt.Println(doc.String())
58```
59
60## Feedback
61
62Got some feedback or suggestions? Please open an issue or drop me a note!
63
64* [Twitter](https://twitter.com/mueslix)
65* [The Fediverse](https://mastodon.social/@fribbledom)