# README
formatcore
import "github.com/phsym/gomarkdoc/format/formatcore"
Package formatcore provides utilities for creating formatters like those found in the format package.
Index
- func Bold(text string) string
- func CodeBlock(code string) string
- func Escape(text string) string
- func GFMAccordion(title, body string) string
- func GFMAccordionHeader(title string) string
- func GFMAccordionTerminator() string
- func GFMCodeBlock(language, code string) string
- func Header(level int, text string) (string, error)
- func Link(text, href string) string
- func ListEntry(depth int, text string) string
- func Paragraph(text string) string
- func PlainText(text string) string
func Bold
func Bold(text string) string
Bold converts the provided text to bold
func CodeBlock
func CodeBlock(code string) string
CodeBlock wraps the provided code as a code block. Language syntax highlighting is not supported.
func Escape
func Escape(text string) string
Escape escapes the special characters in the provided text, but leaves URLs found intact. Note that the URLs included must begin with a scheme to skip the escaping.
func GFMAccordion
func GFMAccordion(title, body string) string
GFMAccordion generates a collapsible content. The accordion's visible title while collapsed is the provided title and the expanded content is the body.
func GFMAccordionHeader
func GFMAccordionHeader(title string) string
GFMAccordionHeader generates the header visible when an accordion is collapsed.
The GFMAccordionHeader is expected to be used in conjunction with GFMAccordionTerminator() when the demands of the body's rendering requires it to be generated independently. The result looks conceptually like the following:
accordion := GFMAccordionHeader("Accordion Title") + "Accordion Body" + GFMAccordionTerminator()
func GFMAccordionTerminator
func GFMAccordionTerminator() string
GFMAccordionTerminator generates the code necessary to terminate an accordion after the body. It is expected to be used in conjunction with GFMAccordionHeader(). See GFMAccordionHeader for a full description.
func GFMCodeBlock
func GFMCodeBlock(language, code string) string
GFMCodeBlock wraps the provided code as a code block and tags it with the provided language (or no language if the empty string is provided), using the triple backtick format from GitHub Flavored Markdown.
func Header
func Header(level int, text string) (string, error)
Header converts the provided text into a header of the provided level. The level is expected to be at least 1.
func Link
func Link(text, href string) string
Link generates a link with the given text and href values.
func ListEntry
func ListEntry(depth int, text string) string
ListEntry generates an unordered list entry with the provided text at the provided zero-indexed depth. A depth of 0 is considered the topmost level of list.
func Paragraph
func Paragraph(text string) string
Paragraph formats a paragraph with the provided text as the contents.
func PlainText
func PlainText(text string) string
PlainText converts a markdown string to the plain text that appears in the rendered output.
Generated by gomarkdoc