Documentation
¶
Overview ¶
Package codefmt contains basic code reformatting functionality.
Use this package to write CLI examples as commented bash scripts and get nicely-rendered terminal output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Bash = LangInfo{ LineCommentStart: "#", } Go = LangInfo{ LineCommentStart: "//", } )
Defined LangInfo for reuse.
Functions ¶
func StaticColumns ¶
StaticColumns is a static columns setting.
Types ¶
type Formatter ¶
type Formatter struct {
Comment func(comment string, loc Location) string // reformats inline code blocks
Code func(code string, loc Location) string // reformats inline code blocks
Indent func(loc Location) string // produces indent for a line's location
// produce column width for wrapping
// (nil function or 0 return value disables wrapping)
Columns func() int
WrapMode WrapMode
}
Formatter formats Markdown for terminal output.
type LangInfo ¶
type LangInfo struct {
LineCommentStart string // Starts line comments
}
LangInfo defines basic language information needed for parsing.
type Location ¶
type Location struct {
LineComment bool // In a line comment
}
Location describes the current location of text in a document.
Click to show internal directories.
Click to hide internal directories.