github.com/dkischenko/gomarkdoc@v0.0.0-20230516135336-e40deae8a495/format/formatcore/README.md (about)

     1  <!-- Code generated by gomarkdoc. DO NOT EDIT -->
     2  
     3  # formatcore
     4  
     5  ```go
     6  import "github.com/dkischenko/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 Anchor(anchor string) string](<#Anchor>)
    14  - [func AnchorHeader(level int, text, anchor string) (string, error)](<#AnchorHeader>)
    15  - [func Bold(text string) string](<#Bold>)
    16  - [func CodeBlock(code string) string](<#CodeBlock>)
    17  - [func Escape(text string) string](<#Escape>)
    18  - [func GFMAccordion(title, body string) string](<#GFMAccordion>)
    19  - [func GFMAccordionHeader(title string) string](<#GFMAccordionHeader>)
    20  - [func GFMAccordionTerminator() string](<#GFMAccordionTerminator>)
    21  - [func GFMCodeBlock(language, code string) string](<#GFMCodeBlock>)
    22  - [func Header(level int, text string) (string, error)](<#Header>)
    23  - [func Link(text, href string) string](<#Link>)
    24  - [func ListEntry(depth int, text string) string](<#ListEntry>)
    25  - [func PlainText(text string) string](<#PlainText>)
    26  
    27  
    28  <a name="Anchor"></a>
    29  ## func [Anchor](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L49>)
    30  
    31  ```go
    32  func Anchor(anchor string) string
    33  ```
    34  
    35  Anchor produces an anchor for the provided link.
    36  
    37  <a name="AnchorHeader"></a>
    38  ## func [AnchorHeader](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L58>)
    39  
    40  ```go
    41  func AnchorHeader(level int, text, anchor string) (string, error)
    42  ```
    43  
    44  AnchorHeader converts the provided text and custom anchor link into a header of the provided level. The level is expected to be at least 1.
    45  
    46  <a name="Bold"></a>
    47  ## func [Bold](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L15>)
    48  
    49  ```go
    50  func Bold(text string) string
    51  ```
    52  
    53  Bold converts the provided text to bold
    54  
    55  <a name="CodeBlock"></a>
    56  ## func [CodeBlock](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L25>)
    57  
    58  ```go
    59  func CodeBlock(code string) string
    60  ```
    61  
    62  CodeBlock wraps the provided code as a code block. Language syntax highlighting is not supported.
    63  
    64  <a name="Escape"></a>
    65  ## func [Escape](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L151>)
    66  
    67  ```go
    68  func Escape(text string) string
    69  ```
    70  
    71  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.
    72  
    73  <a name="GFMAccordion"></a>
    74  ## func [GFMAccordion](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L119>)
    75  
    76  ```go
    77  func GFMAccordion(title, body string) string
    78  ```
    79  
    80  GFMAccordion generates a collapsible content. The accordion's visible title while collapsed is the provided title and the expanded content is the body.
    81  
    82  <a name="GFMAccordionHeader"></a>
    83  ## func [GFMAccordionHeader](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L132>)
    84  
    85  ```go
    86  func GFMAccordionHeader(title string) string
    87  ```
    88  
    89  GFMAccordionHeader generates the header visible when an accordion is collapsed.
    90  
    91  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:
    92  
    93  ```
    94  accordion := GFMAccordionHeader("Accordion Title") + "Accordion Body" + GFMAccordionTerminator()
    95  ```
    96  
    97  <a name="GFMAccordionTerminator"></a>
    98  ## func [GFMAccordionTerminator](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L139>)
    99  
   100  ```go
   101  func GFMAccordionTerminator() string
   102  ```
   103  
   104  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.
   105  
   106  <a name="GFMCodeBlock"></a>
   107  ## func [GFMCodeBlock](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L44>)
   108  
   109  ```go
   110  func GFMCodeBlock(language, code string) string
   111  ```
   112  
   113  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.
   114  
   115  <a name="Header"></a>
   116  ## func [Header](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L69>)
   117  
   118  ```go
   119  func Header(level int, text string) (string, error)
   120  ```
   121  
   122  Header converts the provided text into a header of the provided level. The level is expected to be at least 1.
   123  
   124  <a name="Link"></a>
   125  ## func [Link](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L92>)
   126  
   127  ```go
   128  func Link(text, href string) string
   129  ```
   130  
   131  Link generates a link with the given text and href values.
   132  
   133  <a name="ListEntry"></a>
   134  ## func [ListEntry](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L107>)
   135  
   136  ```go
   137  func ListEntry(depth int, text string) string
   138  ```
   139  
   140  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.
   141  
   142  <a name="PlainText"></a>
   143  ## func [PlainText](<https://github.com/dkischenko/gomarkdoc/blob/master/format/formatcore/base.go#L188>)
   144  
   145  ```go
   146  func PlainText(text string) string
   147  ```
   148  
   149  PlainText converts a markdown string to the plain text that appears in the rendered output.
   150  
   151  Generated by [gomarkdoc](<https://github.com/dkischenko/gomarkdoc>)