From 85a7435d0095d93ac447fc4f7de6ea978fbce7d8 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Sat, 31 Dec 2022 22:29:20 -0800 Subject: [PATCH] Add paige/code.html shortcode --- README.md | 19 +++++++++++++++++++ layouts/shortcodes/paige/code.html | 6 ++++++ 2 files changed, 25 insertions(+) create mode 100644 layouts/shortcodes/paige/code.html diff --git a/README.md b/README.md index f16f7e94..8cc07034 100644 --- a/README.md +++ b/README.md @@ -472,6 +472,8 @@ title: Search ## Shortcodes +### Images + 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 has optional alt, title, width, and height attributes, @@ -498,6 +500,23 @@ These are the rest of the named parameters: 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" >}} + + + +

Test

+ + +{{< /paige/code >}} +``` + ## Customization If `partials/paige/head-last.html` exists in the site, it is included at the end of the head tag. diff --git a/layouts/shortcodes/paige/code.html b/layouts/shortcodes/paige/code.html new file mode 100644 index 00000000..7ee32ce8 --- /dev/null +++ b/layouts/shortcodes/paige/code.html @@ -0,0 +1,6 @@ +
+ {{ highlight .Inner (.Get 0 | default (.Get "lang")) (.Get 2 | default (.Get "options")) }} + {{ with (.Get 1 | default (.Get "caption")) }} +
{{ . }}
+ {{ end }} +