Skip to content

Commit 4b8aa57

Browse files
authoredFeb 28, 2020
Im/fix list item notes (chef#2355)
* Fix shortcodes in list item notes in aws_marketplace Signed-off-by: IanMadd <[email protected]> * Fix shortcode text in deliver_config_json_setting_build_cookbook to render properly in a list Signed-off-by: IanMadd <[email protected]> * fix notes warnings and shortcodes in lists Signed-off-by: IanMadd <[email protected]> * Update readme Signed-off-by: IanMadd <[email protected]>
1 parent 2543f4b commit 4b8aa57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+457
-470
lines changed
 

‎README.md

+45-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ definition lists.
6363

6464
## Shortcodes
6565

66-
Shortcodes are simple snippets of code that can be used to modify a markdown
66+
Shortcodes are simple snippets of code that can be used to modify a Markdown
6767
page by adding content or changing the appearance of content in a page. See
6868
Hugo's [shortcode documentation](https://gohugo.io/content-management/shortcodes/)
6969
for general information about shortcodes.
@@ -82,11 +82,29 @@ to a shortcode file located in `chef-web-docs/layouts/shortcodes`.
8282

8383
To add that shortcode to a page in `chef-web-docs/content`, add the file name,
8484
minus the .md suffix, wrapped in double curly braces and percent symbols to
85-
the location in the markdown page where you want that text included. For example,
85+
the location in the Markdown page where you want that text included. For example,
8686
if you want to add the text in `shortcode_file_name.md` to a page, add
8787
`{{% shortcode_file_name %}}` to the text of that page and it will appear when
8888
Hugo rebuilds the documentation.
8989

90+
**Shortcodes in lists**
91+
92+
Hugo doesn't handle shortcodes that are indented in a list item properly. It intereprets
93+
the text of the shortcode as a code block. More complicated shortcodes with
94+
code blocks, notes, additional list items, or other formatting look pretty
95+
bad. We've created a simple shortcode for handling shortcodes in lists or definition
96+
lists called `shortcode_indent`.
97+
98+
To include a shortcode in a list or definition list, just add its file name
99+
to the `shortcode` parameter of `shortcode_indent` without the .md suffix.
100+
101+
For example, if you wanted to add `shortcode_file_name.md` to a list:
102+
``` md
103+
1. Here is some text introducing the shortcode, but it's not necessary.
104+
105+
{{< shortcode_indent shortcode="shortcode_file_name" >}}
106+
```
107+
90108
### Highlighting blocks of text
91109

92110
We also use shortcodes to highlight text in notes, warnings or danger notices.
@@ -99,12 +117,36 @@ that you want in a note using opening and closing shortcode notation. For exampl
99117
Note text that gives the user additional important information.
100118
101119
{{< /note >}}
102-
103120
```
104121

105122
To add a warning or danger, replace the word `note` with `warning` or `danger` in the
106123
example above.
107124

125+
**Notes in lists**
126+
127+
Hugo doesn't handle shortcodes that are indented in lists very well, that includes the Note,
128+
Warning, and Danger shortcodes. It interprets the indented text that's inside
129+
the Note as a code block when it should be interpreted as Markdown.
130+
131+
To resolve this problem, there's a `spaces` parameter that can be added to the Note,
132+
Warning, and Danger shortcodes. The value of spaces should be set to the number
133+
of spaces that the note is indented.
134+
135+
For example:
136+
```
137+
This is a list:
138+
139+
- List item.
140+
141+
{{< note spaces=4 >}}
142+
143+
Text that gives the user additional important information about that list item.
144+
145+
{{< /note >}}
146+
```
147+
148+
This parameter also works on Danger and Warning shortcodes.
149+
108150
## Sending feedback
109151

110152
We love getting feedback. You can use:

‎content/api_push_jobs.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ where:
123123
- `file` is a string that will be stored as a file on each node, with
124124
the path provided to the command as an environment variable.
125125

126-
{{< note >}}
126+
{{< note spaces=4 >}}
127127

128-
The string has a required prefix of `raw:` or `base64:`, indicating
129-
the encoding (if any) of the contents. The path to this file will be
130-
made available via the `CHEF_PUSH_JOB_FILE` environment variable.
128+
The string has a required prefix of `raw:` or `base64:`, indicating
129+
the encoding (if any) of the contents. The path to this file will be
130+
made available via the `CHEF_PUSH_JOB_FILE` environment variable.
131131

132132
{{< /note >}}
133133

0 commit comments

Comments
 (0)
Please sign in to comment.