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 ### Custom Title, List of Attachments Ending in pdf or mp4
````go ````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 ### 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 ### Other
#### With User-Defined Color and Font Awesome Brand Icon #### With User-Defined Color, Font Awesome Brand Icon and Markdown Title and Content
````go ````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 #### With Icon Content

View file

@ -150,13 +150,13 @@ Once the button is clicked, it opens another browser tab for the given URL.
### Other ### Other
#### With User-Defined Color and Font Awesome Brand Icon #### With User-Defined Color, Font Awesome Brand Icon and Markdown Title
````go ````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 #### 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 ### Arbitrary Text
````go ````go
{{%/* expand title="Show me almost endless possibilities" */%}} {{%/* expand title="Show me almost **endless** possibilities" */%}}
You can add standard markdown syntax: You can add standard markdown syntax:
- multiple paragraphs - multiple paragraphs
@ -89,7 +89,7 @@ You can add standard markdown syntax:
{{%/* /expand */%}} {{%/* /expand */%}}
```` ````
{{% expand title="Show me almost endless possibilities" %}} {{% expand title="Show me almost **endless** possibilities" %}}
You can add standard markdown syntax: You can add standard markdown syntax:
- multiple paragraphs - multiple paragraphs

View file

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

View file

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

View file

@ -16,5 +16,5 @@
{{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- $icon = printf "fa-fw fas fa-%s" $icon }}
{{- end }} {{- end }}
{{- with $context -}} {{- 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 }} {{- end }}

View file

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

View file

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

View file

@ -17,7 +17,7 @@
{{- end }} {{- end }}
{{- with $context }} {{- with $context }}
<div class="box notices cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}> <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"> <div class="box-content">
{{ $content | safeHTML }} </div> {{ $content | safeHTML }} </div>
</div> </div>