github.com/phsym/gomarkdoc@v0.5.4/format/formatcore/README.md (about) 1 <!-- Code generated by gomarkdoc. DO NOT EDIT --> 2 3 # formatcore 4 5 ```go 6 import "github.com/phsym/gomarkdoc/format/formatcore" 7 ``` 8 9 Package formatcore provides utilities for creating formatters like those found in the format package. 10 11 ## Index 12 13 - [func Bold(text string) string](<#func-bold>) 14 - [func CodeBlock(code string) string](<#func-codeblock>) 15 - [func Escape(text string) string](<#func-escape>) 16 - [func GFMAccordion(title, body string) string](<#func-gfmaccordion>) 17 - [func GFMAccordionHeader(title string) string](<#func-gfmaccordionheader>) 18 - [func GFMAccordionTerminator() string](<#func-gfmaccordionterminator>) 19 - [func GFMCodeBlock(language, code string) string](<#func-gfmcodeblock>) 20 - [func Header(level int, text string) (string, error)](<#func-header>) 21 - [func Link(text, href string) string](<#func-link>) 22 - [func ListEntry(depth int, text string) string](<#func-listentry>) 23 - [func Paragraph(text string) string](<#func-paragraph>) 24 - [func PlainText(text string) string](<#func-plaintext>) 25 26 27 ## func [Bold](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L14>) 28 29 ```go 30 func Bold(text string) string 31 ``` 32 33 Bold converts the provided text to bold 34 35 ## func [CodeBlock](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L24>) 36 37 ```go 38 func CodeBlock(code string) string 39 ``` 40 41 CodeBlock wraps the provided code as a code block. Language syntax highlighting is not supported. 42 43 ## func [Escape](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L138>) 44 45 ```go 46 func Escape(text string) string 47 ``` 48 49 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. 50 51 ## func [GFMAccordion](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L101>) 52 53 ```go 54 func GFMAccordion(title, body string) string 55 ``` 56 57 GFMAccordion generates a collapsible content. The accordion's visible title while collapsed is the provided title and the expanded content is the body. 58 59 ## func [GFMAccordionHeader](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L114>) 60 61 ```go 62 func GFMAccordionHeader(title string) string 63 ``` 64 65 GFMAccordionHeader generates the header visible when an accordion is collapsed. 66 67 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: 68 69 ``` 70 accordion := GFMAccordionHeader("Accordion Title") + "Accordion Body" + GFMAccordionTerminator() 71 ``` 72 73 ## func [GFMAccordionTerminator](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L121>) 74 75 ```go 76 func GFMAccordionTerminator() string 77 ``` 78 79 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. 80 81 ## func [GFMCodeBlock](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L45>) 82 83 ```go 84 func GFMCodeBlock(language, code string) string 85 ``` 86 87 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. 88 89 ## func [Header](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L51>) 90 91 ```go 92 func Header(level int, text string) (string, error) 93 ``` 94 95 Header converts the provided text into a header of the provided level. The level is expected to be at least 1. 96 97 ## func [Link](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L74>) 98 99 ```go 100 func Link(text, href string) string 101 ``` 102 103 Link generates a link with the given text and href values. 104 105 ## func [ListEntry](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L89>) 106 107 ```go 108 func ListEntry(depth int, text string) string 109 ``` 110 111 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. 112 113 ## func [Paragraph](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L126>) 114 115 ```go 116 func Paragraph(text string) string 117 ``` 118 119 Paragraph formats a paragraph with the provided text as the contents. 120 121 ## func [PlainText](<https://github.com/phsym/gomarkdoc/blob/master/format/formatcore/base.go#L175>) 122 123 ```go 124 func PlainText(text string) string 125 ``` 126 127 PlainText converts a markdown string to the plain text that appears in the rendered output. 128 129 130 131 Generated by [gomarkdoc](<https://github.com/phsym/gomarkdoc>)