Skip to content

Commit aca69d0

Browse files
authored
Update Readme to add examples for template functions (#573)
1 parent 55b4e60 commit aca69d0

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -383,18 +383,18 @@ using the following data fields and functions:
383383
384384
#### Template Functions
385385
386-
| Function | Description |
387-
|-----------------|---------------------------------------------------------------------------------------------------|
388-
| `codefile` | Create a Markdown code block with the content of a file. Path is relative to the repository root. |
389-
| `lower` | Equivalent to [`strings.ToLower`](https://pkg.go.dev/strings#ToLower). |
390-
| `plainmarkdown` | Render Markdown content as plaintext. |
391-
| `prefixlines` | Add a prefix to all (newline-separated) lines in a string. |
392-
| `printf` | Equivalent to [`fmt.Printf`](https://pkg.go.dev/fmt#Printf). |
393-
| `split` | Split string into sub-strings, by a given separator (ex. `split .Name "_"`). |
394-
| `title` | Equivalent to [`cases.Title`](https://pkg.go.dev/golang.org/x/text/cases#Title). |
395-
| `tffile` | A special case of the `codefile` function, designed for Terraform files (i.e. `.tf`). |
396-
| `trimspace` | Equivalent to [`strings.TrimSpace`](https://pkg.go.dev/strings#TrimSpace). |
397-
| `upper` | Equivalent to [`strings.ToUpper`](https://pkg.go.dev/strings#ToUpper). |
386+
| Function | Example | Description |
387+
|-----------------|--------------------------------------------------|---------------------------------------------------------------------------------------------------|
388+
| `codefile` | `{{codefile "shell" "path/to/file.sh"}}` | Create a Markdown code block with the content of a file. Path is relative to the repository root. |
389+
| `lower` | `{{"EXAMPLE STRING" \| lower}}` | Equivalent to [`strings.ToLower`](https://pkg.go.dev/strings#ToLower). |
390+
| `plainmarkdown` | `{{"*example markdown*" \| plainmarkdown }}` | Render Markdown content as plaintext. |
391+
| `prefixlines` | `{{"example string" \| prefixlines "prefix: "}}` | Add a prefix to all (newline-separated) lines in a string. |
392+
| `printf` | `{{printf "{{tffile %q}}" .ExampleFile}}` | Equivalent to [`fmt.Printf`](https://pkg.go.dev/fmt#Printf). |
393+
| `split` | `{{split "example,string" ","}}` | Split string into sub-strings, by a given separator. |
394+
| `title` | `{{"example string" \| title}}` | Equivalent to [`cases.Title`](https://pkg.go.dev/golang.org/x/text/cases#Title). |
395+
| `tffile` | `{{tffile "path/to/tffile.tf"}}` | A special case of the `codefile` function, designed for Terraform files (i.e. `.tf`). |
396+
| `trimspace` | `{{"example string" \| trimspace}}` | Equivalent to [`strings.TrimSpace`](https://pkg.go.dev/strings#TrimSpace). |
397+
| `upper` | `{{"example string" \| upper}}` | Equivalent to [`strings.ToUpper`](https://pkg.go.dev/strings#ToUpper). |
398398
399399
## Disclaimer
400400

0 commit comments

Comments
 (0)