Skip to content

Commit

Permalink
shortcodes: allow markdown for title and content #502
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed Mar 14, 2023
1 parent f4d9ce0 commit bb895ce
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions exampleSite/content/shortcodes/attachments.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions exampleSite/content/shortcodes/badge.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions exampleSite/content/shortcodes/button.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/shortcodes/expand.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions exampleSite/content/shortcodes/notice.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}}
2 changes: 1 addition & 1 deletion layouts/partials/shortcodes/attachments.html
Original file line number Diff line number Diff line change
Expand Up @@ -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/" "" }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/shortcodes/badge.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
4 changes: 2 additions & 2 deletions layouts/partials/shortcodes/button.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/shortcodes/expand.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/shortcodes/notice.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit bb895ce

Please sign in to comment.