github.com/rmarku/gomarkdoc@v0.0.0-20230517164305-78688ebe4325/format/formatcore/README.md (about)

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