shortcodes: allow markdown for title and content #502

This commit is contained in:
Sören Weber 2023-03-14 21:48:18 +01:00
parent f4d9ce016b
commit bb895ce61d
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
10 changed files with 19 additions and 19 deletions

View file

@ -97,10 +97,10 @@ Eg. for a site in English and Piratish:
### Custom Title, List of Attachments Ending in pdf or mp4
````go
{{%/* attachments title="Related files" pattern=".*\.(pdf|mp4)" /*/%}}
{{%/* attachments title="Related **files**" pattern=".*\.(pdf|mp4)" /*/%}}
````
{{% attachments title="Related files" pattern=".*\.(pdf|mp4)" /%}}
{{% attachments title="Related **files**" pattern=".*\.(pdf|mp4)" /%}}
### Info Styled Box, Descending Sort Order

View file

@ -188,13 +188,13 @@ While the examples are using shortcodes with named parameter you are free to als
### Other
#### With User-Defined Color and Font Awesome Brand Icon
#### With User-Defined Color, Font Awesome Brand Icon and Markdown Title and Content
````go
{{%/* badge color="fuchsia" icon="fab fa-hackerrank" %}}Awesome{{% /badge */%}}
{{%/* badge color="fuchsia" icon="fab fa-hackerrank" title="**Font**" %}}**Awesome**{{% /badge */%}}
````
{{% badge color="fuchsia" icon="fab fa-hackerrank" %}}Awesome{{% /badge %}}
{{% badge color="fuchsia" icon="fab fa-hackerrank" title="**Font**" %}}**Awesome**{{% /badge %}}
#### With Icon Content

View file

@ -150,13 +150,13 @@ Once the button is clicked, it opens another browser tab for the given URL.
### Other
#### With User-Defined Color and Font Awesome Brand Icon
#### With User-Defined Color, Font Awesome Brand Icon and Markdown Title
````go
{{%/* button href="https://gohugo.io/" color="fuchsia" icon="fab fa-hackerrank" %}}Hugo{{% /button */%}}
{{%/* button href="https://gohugo.io/" color="fuchsia" icon="fab fa-hackerrank" %}}Get **Hugo**{{% /button */%}}
````
{{% button href="https://gohugo.io/" color="fuchsia" icon="fab fa-hackerrank" %}}Hugo{{% /button %}}
{{% button href="https://gohugo.io/" color="fuchsia" icon="fab fa-hackerrank" %}}Get **Hugo**{{% /button %}}
#### Severity Style with All Defaults

View file

@ -72,7 +72,7 @@ While the examples are using shortcodes with named parameter you are free to use
### Arbitrary Text
````go
{{%/* expand title="Show me almost endless possibilities" */%}}
{{%/* expand title="Show me almost **endless** possibilities" */%}}
You can add standard markdown syntax:
- multiple paragraphs
@ -89,7 +89,7 @@ You can add standard markdown syntax:
{{%/* /expand */%}}
````
{{% expand title="Show me almost endless possibilities" %}}
{{% expand title="Show me almost **endless** possibilities" %}}
You can add standard markdown syntax:
- multiple paragraphs

View file

@ -286,14 +286,14 @@ Some serious information.
Some serious information.
{{% /notice %}}
### With User-Defined Color and Font Awesome Brand Icon
### With User-Defined Color, Font Awesome Brand Icon and Markdown Title
````go
{{%/* notice color="fuchsia" title="Hugo" icon="fab fa-hackerrank" */%}}
{{%/* notice color="fuchsia" title="**Hugo**" icon="fab fa-hackerrank" */%}}
Victor? Is it you?
{{%/* /notice */%}}
````
{{% notice color="fuchsia" title="Hugo" icon="fab fa-hackerrank" %}}
{{% notice color="fuchsia" title="**Hugo**" icon="fab fa-hackerrank" %}}
Victor? Is it you?
{{% /notice %}}

View file

@ -30,7 +30,7 @@
{{- $urlPrefix := strings.TrimRight "/" $context.Page.RelPermalink }}
{{- with $context }}
<div class="box attachments cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title }}</div>
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | markdownify }}</div>
<ul class="box-content attachments-files">
{{- $fileLink := printf "%s/%s" (.Page.Language.ContentDir | default "content") .Page.File.Dir }}
{{- $fileLink = replace (replace $fileLink "\\" "/") "content/" "" }}

View file

@ -16,5 +16,5 @@
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
{{- end }}
{{- with $context -}}
<span class="badge cstyle {{ $style }}{{ if or $icon $title }} badge-with-title{{ end }}">{{ if or $icon $title }}<span class="badge-title">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ if $title }}{{ $title }}{{ end }}</span>{{ end }}<span class="badge-content"{{ if $color }} style="background-color: {{ $color }};"{{ end }}>{{ $content }}</span></span>
<span class="badge cstyle {{ $style }}{{ if or $icon $title }} badge-with-title{{ end }}">{{ if or $icon $title }}<span class="badge-title">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ if $title }}{{ $title | markdownify }}{{ end }}</span>{{ end }}<span class="badge-content"{{ if $color }} style="background-color: {{ $color }};"{{ end }}>{{ $content }}</span></span>
{{- end }}

View file

@ -44,8 +44,8 @@
{{- end }}
{{- if and $icon (eq $iconposition "left") }}
<i class="{{ $icon }}"></i>
{{- end }}
{{ $title }}
{{- end }}
{{ $title | safeHTML }}
{{- if and $icon (eq $iconposition "right") }}
<i class="{{ $icon }}"></i>
{{- end }}

View file

@ -13,7 +13,7 @@
<label class="expand-label" for="expand-{{ $id }}" >
<i class="fas fa-chevron-down"></i>
<i class="fas fa-chevron-right"></i>
{{ $title }}
{{ $title | markdownify }}
</label>
<div id="expandcontent-{{ $id }}" class="expand-content">
{{ $content | safeHTML }}

View file

@ -17,7 +17,7 @@
{{- end }}
{{- with $context }}
<div class="box notices cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title }}</div>
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | markdownify }}</div>
<div class="box-content">
{{ $content | safeHTML }} </div>
</div>