docs: normalize shortcode documentation (#276)

This commit is contained in:
Robert Kaussow 2022-07-11 14:27:54 +02:00 committed by GitHub
parent 349d6529f1
commit 42f408b2d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 27 deletions

View File

@ -20,18 +20,18 @@ Include shortcode can include files of different types. By specifying a language
```
<!-- prettier-ignore-end -->
Attributes:
## Attributes
| Name | Usage | default |
| Name | Description | default |
| -------- | ----------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| file | path to the included file relative to the Hugo root | undefined |
| language | language for [syntax highlighting](https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages) | undefined |
| type | special include type (`html,page`) | undefined (rendered as markdown) |
| options | highlighting [options](https://gohugo.io/content-management/syntax-highlighting/#highlight-shortcode) | `linenos=table` |
## Examples
## Usage
### Markdown file (default)
## Markdown file (default)
If no other options are specified, files will be rendered as Markdown using the `RenderString` [function](https://gohugo.io/functions/renderstring/).
@ -51,7 +51,7 @@ If you include markdown files that should not get a menu entry, place them outsi
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
### Language files
## Language files
This method can be used to include source code files and keep them automatically up to date.
@ -68,9 +68,9 @@ Result:
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
### Special include types
## Special include types
#### HTML
### HTML
HTML content will be filtered by the `safeHTML` filter and added to the rendered page output.
@ -81,7 +81,7 @@ HTML content will be filtered by the `safeHTML` filter and added to the rendered
{{< include file="/static/_includes/example.html.part" type="html" >}}
#### Pages
### Pages
In some situations, it can be helpful to include Markdown files that also contain shortcodes. While the [default method](#markdown-file-default) works fine to render plain Markdown, shortcodes are not parsed. The only way to get this to work is to use Hugo pages. There are several ways to structure these include pages, so whatever you do, keep in mind that Hugo needs to be able to render and serve these files as regular pages! How it works:

View File

@ -36,9 +36,17 @@ Buttons are styled links that can lead to local page or external link.
The Columns shortcode can be used to organize content side-by-side (horizontally) for better readability.
### Attributes
| Name | Description | default |
| --------------- | ------------------------------------------------ | ------- |
| size (optional) | size of the first column (small\|regular\|large) | regular |
### Usage
<!-- prettier-ignore -->
```html
{{</* columns */>}} <!-- begin columns block -->
{{</* columns [size="small|regular|large"] */>}} <!-- begin columns block -->
# Left Content
Dolor sit, sumo unique argument um no ...
@ -160,19 +168,19 @@ copious quo ad. Stet probates in duo.
Hint shortcode can be used as hint/alerts/notification block.
Attributes:
### Attributes
| Name | Usage | default |
| ---------------- | --------------------------------------------------------------------------------------- | --------------------- |
| type | color types to choose from | note |
| icon (optional) | custom icon to use | undefined (type name) |
| title (optional) | custom icon to use, need to be an icon from an [SVG sprite](/posts/features/icon-sets/) | undefined (type name) |
| Name | Description | default |
| ---------------- | -------------------------------------------------------------------------------------- | --------- |
| type | hint type | note |
| icon (optional) | custom icon to use,need to be an icon from an [SVG sprite](/posts/features/icon-sets/) | undefined |
| title (optional) | hint title | undefined |
Syntax:
### Usage
<!-- prettier-ignore-start -->
```tpl
{{</* hint type=[note|tip|important|caution|warning] (icon=gblog_github) (title=GitHub) */>}}
{{</* hint type="note|tip|important|caution|warning" [icon="gblog_github" title="GitHub"] */>}}
**Markdown content**\
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture.
Ornateness bland it ex enc, est yeti am bongo detract re.

View File

@ -53,16 +53,16 @@ If you need more flexibility for your embedded images, you could use the `img` s
<!--more-->
**Attributes:**
## Attributes
| Name | Usage | default |
| ------------- | -------------------------------------------------------------------------------------------------------------- | ----------------- |
| name (string) | Name of the image resource defined in your front matter. | empty |
| alt (string) | Description for displayed image. | resource `.Title` |
| size (string) | Thumbnail size (tiny\|small\|medium\|large). | empty |
| lazy (bool) | Enable or disable image lazy loading. Can be controlled globally by site parameter `geekblogImageLazyLoading`. | true |
| Name | Description | default |
| ---- | -------------------------------------------------------------------------------------------------------------- | ----------------- |
| name | Name of the image resource defined in your front matter. | empty |
| alt | Description for displayed image. | resource `.Title` |
| size | Thumbnail size (profile\|tiny\|small\|medium\|large). | empty |
| lazy | Enable or disable image lazy loading. Can be controlled globally by site parameter `geekblogImageLazyLoading`. | true |
**Example:**
## Usage
Define your resources in the page front matter, custom parameter `params.credits` is optional.
@ -83,7 +83,7 @@ resources:
<!-- spellchecker-enable -->
**Demo:**
## Example
<!-- spellchecker-disable -->