Documentation ¶
Overview ¶
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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CodeBlock ¶
CodeBlock wraps the provided code as a code block. Language syntax highlighting is not supported.
func Escape ¶
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 ¶
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 ¶
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 ¶
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 ¶
Header converts the provided text into a header of the provided level. The level is expected to be at least 1.
func ListEntry ¶
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.
Types ¶
This section is empty.