From efb97738a2dc387bf511fe5858bca7d0177c7574 Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Thu, 9 Feb 2023 15:26:37 +0100 Subject: [PATCH] shortcode 'blocks/lead':lead: improvements - use Hugo's native support for processing HTML & markdown (#906) - drop support for pre-Hugo-0.54.x behavior of {{% %}} #939 --- layouts/shortcodes/blocks/lead.html | 29 ++++++++++--------- userguide/content/en/_index.html | 4 +-- .../docs/adding-content/shortcodes/index.md | 9 +++--- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/layouts/shortcodes/blocks/lead.html b/layouts/shortcodes/blocks/lead.html index 16e5da49e8..6a8018d17a 100644 --- a/layouts/shortcodes/blocks/lead.html +++ b/layouts/shortcodes/blocks/lead.html @@ -1,16 +1,17 @@ -{{ $_hugo_config := `{ "version": 1 }` }} -{{ $col_id := .Get "color" | default .Ordinal }} -{{ $height := .Get "height" | default "auto" }} -{{/* Height can be one of: auto, min, med, max, full. */}} +{{ $col_id := .Get "color" | default .Ordinal -}} +{{ $height := .Get "height" | default "auto" -}} +{{/* Check: height must be one of: auto, min, med, max, full. */ -}} +{{ with .Get "height" -}} +{{ if not ( or ( eq . "auto" ) ( eq . "min" ) ( eq . "med" ) ( eq . "max" ) ( eq . "full" ) ) -}} +{{ errorf "shortcode 'lead': parameter height is '%s', must be one of 'auto', 'min', 'med', 'max' or 'full'." . -}} +{{ end -}} +{{ end -}} -
-
-
- {{ if eq .Page.File.Ext "md" }} - {{ .Inner | markdownify }} - {{ else }} - {{ .Inner | htmlUnescape | safeHTML }} - {{ end }} -
-
+
+
+
+ +{{ .Inner -}} +
+
diff --git a/userguide/content/en/_index.html b/userguide/content/en/_index.html index 835f233176..a0081afd37 100644 --- a/userguide/content/en/_index.html +++ b/userguide/content/en/_index.html @@ -15,7 +15,7 @@ {{< /blocks/cover >}} -{{% blocks/lead color="primary" %}} +{{< blocks/lead color="primary" >}} Docsy is a theme for the Hugo static site generator that's specifically designed for technical documentation sets. Our aim is to help you get a working documentation site up and running as easily as possible, so you can concentrate @@ -24,7 +24,7 @@ Deploys by Netlify -{{% /blocks/lead %}} +{{< /blocks/lead >}} {{< blocks/section color="dark" type="features">}} {{% blocks/feature icon="fa-lightbulb" title="See Docsy in action!" url="/docs/examples/" %}} diff --git a/userguide/content/en/docs/adding-content/shortcodes/index.md b/userguide/content/en/docs/adding-content/shortcodes/index.md index 2eda403c90..7d6e3e3b03 100644 --- a/userguide/content/en/docs/adding-content/shortcodes/index.md +++ b/userguide/content/en/docs/adding-content/shortcodes/index.md @@ -81,11 +81,12 @@ TechOS is the OS of the future. Runs on **bare metal** in the **cloud**! {{%/* /blocks/lead */%}} ``` +Use the syntax printed above if the inner content of your `/blocks/lead` shortcode is authored in markdown. In case of HTML content, use square brackets `<>` as innermost delimiters: `{{}}HTML content{{< /blocks/lead */>}}`. -| Parameter | Default | Description | -| ---------------- |------------| ------------| -| height | | See above. -| color | | See above. +| Parameter | Default | Description | +| --------- |--------- | ------------------------------- | +| height | `auto` | [See above.](#shortcode-blocks) | +| color | .Ordinal | [See above.](#shortcode-blocks) | ### blocks/section