Add paige/code.html shortcode
This commit is contained in:
19
README.md
19
README.md
@@ -472,6 +472,8 @@ title: Search
|
|||||||
|
|
||||||
## Shortcodes
|
## Shortcodes
|
||||||
|
|
||||||
|
### Images
|
||||||
|
|
||||||
The `paige/figure` shortcode provides a figure with a centered image and an optional centered caption.
|
The `paige/figure` shortcode provides a figure with a centered image and an optional centered caption.
|
||||||
The image and caption can optionally be displayed inline instead of centered.
|
The image and caption can optionally be displayed inline instead of centered.
|
||||||
The image has optional alt, title, width, and height attributes,
|
The image has optional alt, title, width, and height attributes,
|
||||||
@@ -498,6 +500,23 @@ These are the rest of the named parameters:
|
|||||||
width=500 >}}
|
width=500 >}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
The `paige/code` shortcode provides a figure with centered, highlighted code and an optional caption.
|
||||||
|
|
||||||
|
These are the names and positions of the parameters:
|
||||||
|
|
||||||
|
```
|
||||||
|
{{< paige/code lang="go" caption="My caption" options="linenos=true" >}}
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<body>
|
||||||
|
<p>Test</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
{{< /paige/code >}}
|
||||||
|
```
|
||||||
|
|
||||||
## Customization
|
## Customization
|
||||||
|
|
||||||
If `partials/paige/head-last.html` exists in the site, it is included at the end of the head tag.
|
If `partials/paige/head-last.html` exists in the site, it is included at the end of the head tag.
|
||||||
|
6
layouts/shortcodes/paige/code.html
Normal file
6
layouts/shortcodes/paige/code.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<figure class="align-items-center d-flex flex-column">
|
||||||
|
{{ highlight .Inner (.Get 0 | default (.Get "lang")) (.Get 2 | default (.Get "options")) }}
|
||||||
|
{{ with (.Get 1 | default (.Get "caption")) }}
|
||||||
|
<figcaption class="figure-caption">{{ . }}</figcaption>
|
||||||
|
{{ end }}
|
||||||
|
</figure>
|
Reference in New Issue
Block a user