Skip to content

Commit 162f3a3

Browse files
authored
fix(tabs): prevent markdown blockquote parsing when nested in steps (#912)
* fix(tabs): prevent markdown blockquote parsing when nested in steps Consolidate HTML attributes onto single lines and add proper whitespace trimming to prevent `>` characters on separate lines from being interpreted as markdown blockquotes when tabs are nested inside the steps shortcode. Fixes #876 * chore: add comment explaining single-line HTML requirement
1 parent 02cca4c commit 162f3a3

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

layouts/_partials/shortcodes/tabs.html

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,40 +30,20 @@
3030
{{- /* Generate a unique ID for each tab group. */ -}}
3131
{{- $globalID := printf "tabs-%02v" $tabsID -}}
3232

33+
{{- /* Keep HTML on single lines to avoid `>` being parsed as blockquote when nested in steps (#876) */ -}}
3334
<div class="hextra-scrollbar hx:overflow-x-auto hx:overflow-y-hidden hx:overscroll-x-contain">
34-
<div
35-
class="hx:mt-4 hx:flex hx:w-max hx:min-w-full hx:border-b hx:border-gray-200 hx:pb-px hx:dark:border-neutral-800"
36-
{{ if $enableSync }} data-tab-group="{{ delimit $dataTabGroup `,` }}"{{ end }}
37-
>
35+
<div class="hx:mt-4 hx:flex hx:w-max hx:min-w-full hx:border-b hx:border-gray-200 hx:pb-px hx:dark:border-neutral-800"{{- if $enableSync }} data-tab-group="{{ delimit $dataTabGroup `,` }}"{{- end }}>
3836
{{- range $i, $item := $tabs -}}
39-
<button
40-
class="hextra-tabs-toggle hx:cursor-pointer hx:data-[state=selected]:border-primary-500 hx:data-[state=selected]:text-primary-600 hx:data-[state=selected]:dark:border-primary-500 hx:data-[state=selected]:dark:text-primary-600 hx:mr-2 hx:rounded-t hx:p-2 hx:font-medium hx:leading-5 hx:transition-colors hx:-mb-0.5 hx:select-none hx:border-b-2 hx:border-transparent hx:text-gray-600 hx:hover:border-gray-200 hx:hover:text-black hx:dark:text-gray-200 hx:dark:hover:border-neutral-800 hx:dark:hover:text-white"
41-
role="tab"
42-
type="button"
43-
aria-controls="tabs-panel-{{ $globalID }}-{{ $item.id }}"
44-
{{- if eq $i $selectedIndex -}}
45-
aria-selected="true"
46-
tabindex="0"
47-
data-state="selected"
48-
{{- end }}
49-
>
37+
<button class="hextra-tabs-toggle hx:cursor-pointer hx:data-[state=selected]:border-primary-500 hx:data-[state=selected]:text-primary-600 hx:data-[state=selected]:dark:border-primary-500 hx:data-[state=selected]:dark:text-primary-600 hx:mr-2 hx:rounded-t hx:p-2 hx:font-medium hx:leading-5 hx:transition-colors hx:-mb-0.5 hx:select-none hx:border-b-2 hx:border-transparent hx:text-gray-600 hx:hover:border-gray-200 hx:hover:text-black hx:dark:text-gray-200 hx:dark:hover:border-neutral-800 hx:dark:hover:text-white" role="tab" type="button" aria-controls="tabs-panel-{{ $globalID }}-{{ $item.id }}"{{- if eq $i $selectedIndex }} aria-selected="true" tabindex="0" data-state="selected"{{- end }}>
5038
{{- $item.name -}}
5139
</button>
5240
{{- end -}}
5341
</div>
5442
</div>
5543
<div>
56-
{{- range $i, $item := $tabs -}}
57-
<div
58-
class="hextra-tabs-panel hx:rounded-sm hx:pt-6 hx:hidden hx:data-[state=selected]:block"
59-
id="tabs-panel-{{ $globalID }}-{{ $item.id }}"
60-
role="tabpanel"
61-
{{- if eq $i $selectedIndex -}}
62-
tabindex="0"
63-
data-state="selected"
64-
{{ end -}}
65-
>
66-
{{- $item.content | markdownify -}}
67-
</div>
68-
{{- end -}}
44+
{{- range $i, $item := $tabs -}}
45+
<div class="hextra-tabs-panel hx:rounded-sm hx:pt-6 hx:hidden hx:data-[state=selected]:block" id="tabs-panel-{{ $globalID }}-{{ $item.id }}" role="tabpanel"{{- if eq $i $selectedIndex }} tabindex="0" data-state="selected"{{- end }}>
46+
{{- $item.content | markdownify -}}
47+
</div>
48+
{{- end -}}
6949
</div>

0 commit comments

Comments
 (0)