https://github.com/muesli/roff
roff lets you write roff documents in Go
https://github.com/muesli/roff
Last synced: 6 months ago
JSON representation
roff lets you write roff documents in Go
- Host: GitHub
- URL: https://github.com/muesli/roff
- Owner: muesli
- License: mit
- Created: 2022-01-11T08:36:30.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-11T14:57:17.000Z (over 3 years ago)
- Last Synced: 2024-12-10T00:40:27.192Z (6 months ago)
- Language: Go
- Size: 12.7 KB
- Stars: 48
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# roff
[](https://github.com/muesli/roff/releases)
[](https://github.com/muesli/roff/actions)
[](https://coveralls.io/github/muesli/roff?branch=main)
[](https://goreportcard.com/report/muesli/roff)
[](https://pkg.go.dev/github.com/muesli/roff)roff lets you write roff documents in Go
## Tutorial
Import the library:
```go
import "github.com/muesli/roff"
```Then start a new roff document and write to it:
```go
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:
```go
fmt.Println(doc.String())
```## Feedback
Got some feedback or suggestions? Please open an issue or drop me a note!
* [Twitter](https://twitter.com/mueslix)
* [The Fediverse](https://mastodon.social/@fribbledom)