shortcodes: replace markdownify by .RenderString #555

This commit is contained in:
Sören Weber 2023-06-03 13:14:15 +02:00
parent 7552bcc936
commit 61f05936b1
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
9 changed files with 17 additions and 16 deletions

View file

@ -59,11 +59,11 @@ echo "Hello World!"
"content" (slice
(dict
"name" "python"
"content" ("```python\nprint(\"Hello World!\")\n```" | markdownify)
"content" ("```python\nprint(\"Hello World!\")\n```" | .RenderString)
)
(dict
"name" "bash"
"content" ("```bash\necho \"Hello World!\"\n```" | markdownify)
"content" ("```bash\necho \"Hello World!\"\n```" | .RenderString)
)
)
)}}

View file

@ -1,3 +1,4 @@
{{- $page := .page }}
{{- $title := T "Search" }}
<article class="default">
<header class="headline">
@ -9,7 +10,7 @@
<label class="a11y-only" for="search-by-detail">{{ T "Search" }}</label>
<input data-search-input id="search-by-detail" class="search-by" name="search-by" type="search" placeholder="{{ T "Search-placeholder" }}">
{{- partial "shortcodes/button.html" (dict
"context" .
"context" $page
"type" "submit"
"style" "secondary"
"icon" "search"

View file

@ -3,4 +3,4 @@
{{- partial "heading-pre.html" . }}<h1 id="{{ $title | anchorize }}">{{ $title }}</h1>{{ partial "heading-post.html" . }}
{{- end }}
{{- partial "initial.md" . | markdownify }}
{{- partial "initial.md" . | .RenderString }}

View file

@ -30,7 +30,7 @@
{{- $urlPrefix := strings.TrimRight "/" $context.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 | markdownify }}</div>
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}</div>
<ul class="box-content attachments-files">
{{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }}

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 | markdownify }}{{ end }}</span>{{ end }}<span class="badge-content"{{ if $color }} style="background-color: {{ $color }};"{{ end }}>{{ $content | markdownify }}</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 | .RenderString }}{{ end }}</span>{{ end }}<span class="badge-content"{{ if $color }} style="background-color: {{ $color }};"{{ end }}>{{ $content | .RenderString }}</span></span>
{{- end }}

View file

@ -42,11 +42,11 @@
{{- else }}
<a{{ if $href }} href="{{ $href }}"{{ if gt (len $target) 0 }} target="{{ $target }}"{{ end }}{{ end }}>
{{- end }}
{{- if and $icon (eq $iconposition "left") }}
{{- if and $icon (eq $iconposition "left") }}
<i class="{{ $icon }}"></i>
{{- end }}
{{ $title | markdownify }}
{{- if and $icon (eq $iconposition "right") }}
{{- end }}
{{ $title | .RenderString }}
{{- if and $icon (eq $iconposition "right") }}
<i class="{{ $icon }}"></i>
{{- end }}
{{- if $isButton }}

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 | markdownify }}
{{ $title | .RenderString }}
</label>
<div id="expandcontent-{{ $id }}" class="expand-content">
{{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? -->

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 | markdownify }}</div>
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}</div>
<div class="box-content">
{{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? -->
</div>

View file

@ -6,17 +6,17 @@
<div class="tab-nav">
{{- range $idx, $tab := $tabs }}
<button
data-tab-item="{{ .name | markdownify | plainify }}"
data-tab-item="{{ .name | $context.RenderString | plainify }}"
class="tab-nav-button{{ cond (eq $idx 0) " active" ""}}"
onclick="switchTab('{{ $groupid }}','{{ .name | markdownify | plainify}}')"
onclick="switchTab('{{ $groupid }}','{{ .name | $context.RenderString | plainify}}')"
>
<span>{{ .name | markdownify }}</span></button>
<span>{{ .name | $context.RenderString }}</span></button>
{{- end }}
</div>
<div class="tab-content">
{{- range $idx, $tab := $tabs }}
<div
data-tab-item="{{ .name | markdownify | plainify }}"
data-tab-item="{{ .name | $context.RenderString | plainify }}"
class="tab-content-text{{ cond (eq $idx 0) " active" ""}}"
>
{{ .content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? -->