Skip to content

muesli/roff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

roff

Latest Release Build Status Coverage Status Go ReportCard GoDoc

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!

About

roff lets you write roff documents in Go

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages