From e5021c9d3098d43b57e0bd371af0ac606d727fef Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Wed, 9 Mar 2022 15:14:09 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Allow=20icon=20to=20be=20specifi?= =?UTF-8?q?ed=20in=20`alert`=20shortcode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + exampleSite/content/docs/shortcodes/index.md | 10 ++++++++++ layouts/shortcodes/alert.html | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c11414a3..b85c81ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Markdown images and `figure` shortcode now search the `assets/` directory if an image cannot be found in page bundle ([#126](https://github.com/jpanther/congo/issues/126)) - Markdown images and `figure` shortcode now fallback to static assets if an image is not provided as a Hugo resource ([#126](https://github.com/jpanther/congo/issues/126)) - Taxonomy term listings now honour the `groupByYear` parameter ([#145](https://github.com/jpanther/congo/pull/145)) +- The `alert` shortcode now allows its icon to be specified as a parameter ## [2.0.5] - 2022-02-20 diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index 1ee7361f..8e34a339 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -15,17 +15,27 @@ In addition to all the [default Hugo shortcodes](https://gohugo.io/content-manag The input is written in Markdown so you can format it however you please. +By default, the alert is presented with an exclaimation triangle icon. To change the icon, include the icon name in the shortcode. Check out the [icon shortcode](#icon) for more details on using icons. + **Example:** ```md {{}} **Warning!** This action is destructive! {{}} + +{{}} +Don't forget to [follow me](https://twitter.com/jpanther) on Twitter. +{{}} ``` {{< alert >}} **Warning!** This action is destructive! {{< /alert >}} +  +{{< alert "twitter" >}} +Don't forget to [follow me](https://twitter.com/jpanther) on Twitter. +{{< /alert >}} ## Badge diff --git a/layouts/shortcodes/alert.html b/layouts/shortcodes/alert.html index 827cf46e..41d380d9 100644 --- a/layouts/shortcodes/alert.html +++ b/layouts/shortcodes/alert.html @@ -1,6 +1,6 @@
- {{ partial "icon.html" "exclamation-triangle" }} + {{ partial "icon.html" (.Get 0 | default "exclamation-triangle") }} {{- .Inner | markdownify -}}