doc

package
v0.0.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2015 License: BSD-3-Clause, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExtensionFormat = map[string]Formatter{
	".md":       Markdown,
	".markdown": Markdown,
	".mdown":    Markdown,
	".rdoc":     Markdown,
	".txt":      Text,
	".text":     Text,
	"":          Text,
	".ascii":    Text,
	".rst":      ReStructuredText,
}

ExtensionFormat maps a lowercase file extension (beginning with ".", such as ".md") to the formatter that should be used.

Functions

func ReStructuredTextToHTML

func ReStructuredTextToHTML(rst []byte) ([]byte, error)

func StripNulls

func StripNulls(s string) string

func ToHTML

func ToHTML(formatter Formatter, src []byte) ([]byte, error)

ToHTML converts a source document in format to HTML. If conversion fails, it returns a failsafe plaintext-to-HTML conversion and a non-nil error.

Types

type Formatter

type Formatter string
const (
	Text             Formatter = "text"
	Markdown         Formatter = "markdown"
	ReStructuredText Formatter = "rst"
)

func Format

func Format(filename string) Formatter

Format returns the doc formatter to use for the given filename. It determines it based on the file extension and defaults to plain text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL