Skip to content

Commit 535962b

Browse files
committed
Improve shortcode's use of markdownify
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 4eaeb1d commit 535962b

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

layouts/shortcodes/best-practice.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@ <h5 class="alert-heading">
33
<i class="bi bi-award-fill me-1"></i> Best Practice
44
</h5>
55
<hr>
6-
{{ .Inner | markdownify }}
6+
{{ $inner := .Inner | markdownify }}
7+
{{ if not (findRE "^<p>" $inner) }}
8+
<p>{{ $inner }}</p>
9+
{{ else }}
10+
{{ $inner }}
11+
{{ end }}
712
</div>

layouts/shortcodes/common-pitfall.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@ <h5 class="alert-heading">
33
<i class="bi bi-exclamation-circle-fill me-1"></i> Common Pitfall
44
</h5>
55
<hr>
6-
{{ .Inner | markdownify }}
6+
{{ $inner := .Inner | markdownify }}
7+
{{ if not (findRE "^<p>" $inner) }}
8+
<p>{{ $inner }}</p>
9+
{{ else }}
10+
{{ $inner }}
11+
{{ end }}
712
</div>

layouts/shortcodes/learning-more.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@ <h5 class="alert-heading">
33
<i class="bi bi-book-half me-1"></i> Digging Deeper
44
</h5>
55
<hr>
6-
{{ .Inner | markdownify }}
6+
{{ $inner := .Inner | markdownify }}
7+
{{ if not (findRE "^<p>" $inner) }}
8+
<p>{{ $inner }}</p>
9+
{{ else }}
10+
{{ $inner }}
11+
{{ end }}
712
</div>

0 commit comments

Comments
 (0)