Skip to content

Commit 6572012

Browse files
Clarify preferred shortcode syntax in style guide (#16791)
* Style Guide: Clarify which shortcode syntax should be preferred Fixes #16383 * Apply style guide review suggestions - Remove periods from main bullet points for consistency - Change "simple content" to "plain text content" for clarity Co-authored-by: Cam Soper <[email protected]> --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Cam Soper <[email protected]>
1 parent 76ea7b9 commit 6572012

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

STYLE-GUIDE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,22 @@ This is a useful suggestion.
103103

104104
---
105105

106+
## Shortcode syntax
107+
108+
Hugo supports two shortcode notations:
109+
110+
- **`{{% shortcode %}}`** (percent signs) - Use for shortcodes that process Markdown content. Hugo processes these before Markdown rendering
111+
- Examples: `notes`, `choosable`, `details`
112+
113+
- **`{{< shortcode >}}`** (angle brackets) - Use for shortcodes that output pre-formatted content. Hugo processes these after Markdown rendering
114+
- Examples: `cleanup`, `example`
115+
116+
**Rule of thumb:** If the shortcode uses `markdownify` internally (check `layouts/shortcodes/`), use percent signs. Otherwise, use angle brackets.
117+
118+
Both syntaxes work for plain text content, but use percent signs for shortcodes with nested Markdown like lists or headings.
119+
120+
---
121+
106122
## Paragraphs and Line Breaks
107123

108124
- Separate paragraphs with a blank line.

0 commit comments

Comments
 (0)