mirror of https://github.com/fluxcd/website.git
Add code snippet embed support
Adds the ability to read snippets from a file Signed-off-by: Alison Dowdney <alison@alisondowdney.com>
This commit is contained in:
parent
24d24591e9
commit
82408af5cf
|
@ -85,3 +85,16 @@ If you want to illustrate the documentation and make things easier to read, ther
|
|||
- [`tabpane`](https://www.docsy.dev/docs/adding-content/shortcodes/#tabbed-panes) for pieces of text that go in different tabs
|
||||
- [`cardpane` and `card`](https://www.docsy.dev/docs/adding-content/shortcodes/#card-panes) for adding cards and card panes
|
||||
- [`gist`, `youtube`, `tweet` and more](https://gohugo.io/content-management/shortcodes/): lots of shortcodes we get from Hugo itself.
|
||||
|
||||
## Code snippets
|
||||
|
||||
You can embed code snippets from a file.
|
||||
|
||||
``language`` is any [language supported by GitHub flavored markdown](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml).
|
||||
``file`` is the path to the file you want to use in the code block.
|
||||
|
||||
```go-html-template
|
||||
{{%/* codeblock file="/static/snippet/example.yaml" language="yaml" */%}}
|
||||
```
|
||||
|
||||
{{% codeblock file="/static/snippet/example.yaml" language="yaml" %}}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{{ $file := .Get "file" | readFile }}
|
||||
{{ $lang := .Get "language" }}
|
||||
{{ (print "```" $lang "\n" $file "\n```") | markdownify }}
|
|
@ -0,0 +1,15 @@
|
|||
apiVersion: source.toolkit.fluxcd.io/v1beta1
|
||||
kind: GitRepository
|
||||
metadata:
|
||||
name: podinfo
|
||||
namespace: flux-system
|
||||
spec:
|
||||
interval: 1m
|
||||
url: https://github.com/stefanprodan/podinfo
|
||||
ref:
|
||||
branch: master
|
||||
ignore: |
|
||||
# exclude all
|
||||
/*
|
||||
# include charts directory
|
||||
!/charts/
|
Loading…
Reference in New Issue