Add md flag

This commit is contained in:
Alex Haslam
2026-01-31 20:25:24 +00:00
parent 277f7a94cb
commit 63da02addc
2 changed files with 12 additions and 7 deletions
+6 -6
View File
@@ -130,8 +130,8 @@ The alert sign (`+` or `-`) is optional to control whether the admonition is fol
{{</* badge */>}}New{{</* /badge */>}} {{</* badge */>}}New{{</* /badge */>}}
{{</* /accordionItem */>}} {{</* /accordionItem */>}}
{{</* accordionItem title="Can I use Markdown?" */>}} {{</* accordionItem title="Can I use shortcodes?" md=false */>}}
Yes. Content inside items is Markdown and supports other shortcodes like alerts: Yes. Content inside items can contain other shortcodes like alerts:
{{</* alert */>}}This is an inline alert.{{</* /alert */>}} {{</* alert */>}}This is an inline alert.{{</* /alert */>}}
{{</* /accordionItem */>}} {{</* /accordionItem */>}}
@@ -145,10 +145,10 @@ The alert sign (`+` or `-`) is optional to control whether the admonition is fol
- Flexible layouts - Flexible layouts
- `config`-driven - `config`-driven
{{< badge >}}New{{< /badge >}}
{{< /accordionItem >}} {{< /accordionItem >}}
{{< accordionItem title="Can I use Markdown?" >}} {{< accordionItem title="Can I use Markdown?" md=false >}}
Yes. Content inside items is Markdown and supports other shortcodes like alerts: Yes. Content inside items is Markdown and supports other shortcodes like alerts:
{{< alert >}}This is an inline alert.{{< /alert >}} {{< alert >}}This is an inline alert.{{< /alert >}}
@@ -166,7 +166,7 @@ The alert sign (`+` or `-`) is optional to control whether the admonition is fol
3. Three 3. Three
{{</* /accordionItem */>}} {{</* /accordionItem */>}}
{{</* accordionItem title="Second item" */>}} {{</* accordionItem title="Second item" md=false */>}}
This item includes another shortcode: This item includes another shortcode:
{{</* badge */>}}Tip{{</* /badge */>}} {{</* badge */>}}Tip{{</* /badge */>}}
{{</* /accordionItem */>}} {{</* /accordionItem */>}}
@@ -181,7 +181,7 @@ The alert sign (`+` or `-`) is optional to control whether the admonition is fol
3. Three 3. Three
{{< /accordionItem >}} {{< /accordionItem >}}
{{< accordionItem title="Second item" >}} {{< accordionItem title="Second item" md=false >}}
This item includes another shortcode: This item includes another shortcode:
{{< badge >}}Tip{{< /badge >}} {{< badge >}}Tip{{< /badge >}}
{{< /accordionItem >}} {{< /accordionItem >}}
+6 -1
View File
@@ -6,6 +6,7 @@
{{ $isSeparated := or (eq $separated true) (eq $separated "true") }} {{ $isSeparated := or (eq $separated true) (eq $separated "true") }}
{{ $title := .Get "title" | default (.Get "header") }} {{ $title := .Get "title" | default (.Get "header") }}
{{ $md := .Get "md" | default true }}
{{ $open := .Get "open" | default false }} {{ $open := .Get "open" | default false }}
{{ $isOpen := or (eq $open true) (eq $open "true") }} {{ $isOpen := or (eq $open true) (eq $open "true") }}
@@ -21,6 +22,10 @@
</span> </span>
</summary> </summary>
<div class="px-4 pb-4 text-neutral-700 dark:text-neutral-300"> <div class="px-4 pb-4 text-neutral-700 dark:text-neutral-300">
{{- .Inner | markdownify -}} {{ if $md }}
{{- .Inner | markdownify -}}
{{ else }}
{{- .Inner -}}
{{ end }}
</div> </div>
</details> </details>