feat: add propertylist shortcode (#414)
This commit is contained in:
parent
5b05b7d68a
commit
6ab98d1da3
13 changed files with 154 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
|||
title: Code Blocks
|
||||
---
|
||||
|
||||
There are several ways to add code blocks. Most of them work out of the box, only the Hugo short code `<highlight>` needs to be configured to work properly. The theme also provides some additional features like a copy button and an option to set the maximum length of code blocks. Both of these functions and the dependent formatting rely on the `.highlight` CSS class. You must ensure that you always assign a language to your code blocks if you want to use these functions. If you do not want to apply syntax highlighting, you can also specify `plain` or `text` as the language.
|
||||
There are several ways to add code blocks. Most of them work out of the box, only the Hugo shortcode `<highlight>` needs to be configured to work properly. The theme also provides some additional features like a copy button and an option to set the maximum length of code blocks. Both of these functions and the dependent formatting rely on the `.highlight` CSS class. You must ensure that you always assign a language to your code blocks if you want to use these functions. If you do not want to apply syntax highlighting, you can also specify `plain` or `text` as the language.
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
|
|
23
exampleSite/content/en/shortcodes/propertylist.md
Normal file
23
exampleSite/content/en/shortcodes/propertylist.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
title: Properties
|
||||
---
|
||||
|
||||
The property list shortcode creates a custom HTML description list that can be used to display properties or variables and general dependent information. The shortcode requires a data file in `data/properties/`, e.g. `data/properties/demo.yaml`, where the filename must be passed to the `name` attribute of the property list shortcode.
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
```tpl
|
||||
{{</* propertylist name=demo */>}}
|
||||
```
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
The supported attributes can be taken from the following example:
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
<!-- spellchecker-disable -->
|
||||
{{< include file="/data/properties/demo.yaml" language="Yaml" options="linenos=table" >}}
|
||||
<!-- spellchecker-enable -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
## Example
|
||||
|
||||
{{< propertylist name=demo >}}
|
17
exampleSite/data/properties/demo.yaml
Normal file
17
exampleSite/data/properties/demo.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
properties:
|
||||
prop1:
|
||||
type: string
|
||||
description: Dummy description of the prop1 string property.
|
||||
required: true
|
||||
|
||||
prop2:
|
||||
type: int
|
||||
defaultValue: 10
|
||||
description:
|
||||
en: Another description for the integer property called prop2.
|
||||
required: false
|
||||
tags:
|
||||
en:
|
||||
- tag1
|
||||
- tag2
|
Loading…
Add table
Add a link
Reference in a new issue