Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion _vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# github.com/chef/compliance-profiles/docs-chef-io v0.0.0-20240910135619-26c9a5bfa34f
# github.com/chef/compliance-remediation-2022/docs-chef-io v0.0.0-20240313054833-ebbc45209efa
# github.com/chef/license-service/docs-chef-io v0.0.0-20231117105514-d3f3d53ba2dd
# github.com/chef/chef-docs-theme v0.0.0-20240702130936-2a15b495f5df
# github.com/chef/chef-docs-theme v0.0.0-20241009145630-3872059a00a5
# github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536
# github.com/cowboy/jquery-hashchange v0.0.0-20100902193700-0310f3847f90
# github.com/twitter/hogan.js v3.0.2+incompatible
Expand Down
60 changes: 58 additions & 2 deletions content/style/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,74 @@ culpa qui officia deserunt mollit anim id est laborum.

## `readfile` shortcode

Use the `readfile` shortcode to add files to a page. This could be Markdown text or a code sample.
Use the `readfile` shortcode to add file text to a page. This could be Markdown text or a code sample.

### Markdown

It's default is to add a Markdown file to a page:

```md
{{</* readfile file="path/to/markdown.md" */>}}
```

### Code highlighting

It handles code highlighting. See the [Hugo documentation](https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages) for a full list of syntaxes that it can highlight.

You can add a JSON file like this:

```md
{{</* readfile file="data/test/test.json" highlight="json" */>}}
```

which will produce this:
which produces this:

{{< readfile file="data/test/test.json" highlight="json" >}}

It also converts data between XML, JSON, YAML, and TOML if the highlight value is different from the file type. For example:

```md
{{</* readfile file="data/test/test.json" highlight="yaml" */>}}
```

Which produces this:

{{< readfile file="data/test/test.json" highlight="yaml" >}}

It converts the data to alphabetical order, there's no way to change this behavior.

### Ordered list

If adding file text to an ordered list, you have to format and indent it correctly or it won't display data correctly. Note the three spaces and Markdown shortcode style.

```md
1. A data file:

{{%/* readfile file="data/test/test.json" highlight="json" */%}}

1. The same data file:

{{%/* readfile file="data/test/test.json" highlight="json" */%}}
```

Which produces the following:

1. A data file:

{{% readfile file="data/test/test.json" highlight="json" %}}

1. The same data file:

{{% readfile file="data/test/test.json" highlight="json" %}}

### HTML

You can use `html="true"` to add an HTML file:

```md
{{</* readfile file="path/to/html_file.html" html="true" */>}}
```

## Lists

Markdown doesn't have strict rules about how to process lists. These are things to keep in
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22

require (
github.com/chef/automate/components/docs-chef-io v0.0.0-20240926130942-4b98d9cf92f6 // indirect
github.com/chef/chef-docs-theme v0.0.0-20240702130936-2a15b495f5df // indirect
github.com/chef/chef-docs-theme v0.0.0-20241009145630-3872059a00a5 // indirect
github.com/chef/chef-server/docs-chef-io v0.0.0-20240920053744-03b58ff14f46 // indirect
github.com/chef/chef-workstation/docs-chef-io v0.0.0-20240809064339-878cb76b2b66 // indirect
github.com/chef/compliance-profiles/docs-chef-io v0.0.0-20240910135619-26c9a5bfa34f // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/chef/automate/components/docs-chef-io v0.0.0-20240926130942-4b98d9cf92f6 h1:scrWEAK18Peqbtc3CxwxVaFp595kr+r8eYvYxW7qjQU=
github.com/chef/automate/components/docs-chef-io v0.0.0-20240926130942-4b98d9cf92f6/go.mod h1:juvLC7Rt33YOCgJ5nnfl4rWZRAbSwqjTbWmcAoA0LtU=
github.com/chef/chef-docs-theme v0.0.0-20240702130936-2a15b495f5df h1:R4S5OrcKY2CJHMShYHHeTqIzrAdPvX6bfDyho69Rll0=
github.com/chef/chef-docs-theme v0.0.0-20240702130936-2a15b495f5df/go.mod h1:+Jpnv+LXE6dXu2xDcMzMc0RxRGuCPAoFxq5tJ/X6QpQ=
github.com/chef/chef-docs-theme v0.0.0-20241009145630-3872059a00a5 h1:LtZdS+QMAfZuGTWWBDSox5xvtvJTKTR6cuZLMfJm5x8=
github.com/chef/chef-docs-theme v0.0.0-20241009145630-3872059a00a5/go.mod h1:+Jpnv+LXE6dXu2xDcMzMc0RxRGuCPAoFxq5tJ/X6QpQ=
github.com/chef/chef-server/docs-chef-io v0.0.0-20240920053744-03b58ff14f46 h1:KKSufg3MDKPPzXN2Nv6vUGhx8LIYmYMo9ByQMFbj8Rk=
github.com/chef/chef-server/docs-chef-io v0.0.0-20240920053744-03b58ff14f46/go.mod h1:gMSa25GUHmLimA0gjvRd3hs1buOBqkKPrdHzHvaJauY=
github.com/chef/chef-workstation/docs-chef-io v0.0.0-20240809064339-878cb76b2b66 h1:mGSa2uVyyi8bHyluwmmd83UReZR9gqF/roi5v7lnv0s=
Expand Down