fix(tabs): revert tab and tabs rendering (#772) and update chroma lexers

This commit is contained in:
Cell
2026-07-10 19:44:17 +08:00
parent 43c439eee0
commit a2d756777f
6 changed files with 30 additions and 10 deletions
@@ -13,7 +13,18 @@ tags:
Testing various configurations and nested scenarios for the Tabs shortcode.
{{< tabs >}}
{{% tab title="Test Cases" %}}See Types section for various test cases.{{% /tab %}}
{{% tab title="Test Cases" %}}
See Types section for various test cases.
```go-template {name="Shortcode"}
{{</* tabs */>}}
{{%/* tab title="Test Cases" */%}}
{{%/* tab title="Test Cases" */%}}See Types section for various test cases.{{%/* /tab */%}}
{{%/* tab title="Nested Tabs" */%}}See Nested Tabs section for examples.{{%/* /tab */%}}
{{</* /tabs */>}}
```
{{% /tab %}}
{{% tab title="Nested Tabs" %}}See Nested Tabs section for examples.{{% /tab %}}
{{< /tabs >}}
+8 -1
View File
@@ -34,6 +34,7 @@ $chroma-lexers: (
"as": "ActionScript",
"as3": "ActionScript 3",
"asm": "GAS",
"astro": "Astro",
"atl": "ATL",
"autohotkey": "AutoHotkey",
"autoit": "AutoIt",
@@ -172,7 +173,7 @@ $chroma-lexers: (
"haskell": "Haskell",
"haxe": "Haxe",
"hbs": "Handlebars",
"hcl": "HCL",
"hcl": "Terraform",
"hexdump": "Hexdump",
"hlb": "HLB",
"hlsl": "HLSL",
@@ -184,9 +185,12 @@ $chroma-lexers: (
"html\\+kid": "Genshi HTML",
"html\\+ruby": "ERB",
"http": "HTTP",
"hurl": "Hurl",
"hx": "Haxe",
"hxsl": "Haxe",
"hylang": "Hy",
"hypr": "Hyprlang",
"hyprlang": "Hyprlang",
"idr": "Idris",
"idris": "Idris",
"igor": "Igor",
@@ -201,6 +205,7 @@ $chroma-lexers: (
"javascript": "JavaScript",
"jinja": "Django/Jinja",
"jl": "Julia",
"jq": "JQ",
"js": "JavaScript",
"json": "JSON",
"jsonata": "JSONata",
@@ -425,6 +430,7 @@ $chroma-lexers: (
"tasm": "TASM",
"tcl": "Tcl",
"tcsh": "Tcsh",
"templ": "Templ",
"termcap": "Termcap",
"terminfo": "Terminfo",
"terraform": "Terraform",
@@ -483,6 +489,7 @@ $chroma-lexers: (
"zsh": "Bash",
"µcad": "Microcad",
// Custom code type
"go-html-template": "Go HTML Template",
"markdown": "Markdown",
"yml": "YAML"
) !default;
+1 -1
View File
@@ -1,4 +1,4 @@
{{- hugo.Store.Set "version" "v1.0.0-mraakpxu" -}}
{{- hugo.Store.Set "version" "v1.0.0-mrevbfi8" -}}
{{- .Store.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}
+2 -1
View File
@@ -9,7 +9,8 @@
{{- $id := dict "Page" .Page | partial "function/id.html" -}}
{{- $title := .Get "title" -}}
{{- .Parent.Store.Add "tabs" (slice (dict "title" $title "id" $id)) -}}
{{- $content := trim .Inner "\r\n" -}}
{{- /* Tab panel */ -}}
<div role="tabpanel" aria-labelledby="tab-{{ $id }}" class="tab-panel">{{ .Inner | strings.TrimSpace | .Page.RenderString }}</div>
<div role="tabpanel" aria-labelledby="tab-{{ $id }}" class="tab-panel">{{ $content | safeHTML }}</div>
{{- /* EOF */ -}}
+4 -4
View File
@@ -1,11 +1,11 @@
{{- /*
Renders a tabbed interface with multiple tabs and their corresponding content.
See https://fixit.lruihao.cn/documentation/content-management/shortcodes/extended/tabs/
@param {Int} [defaultTab=0] - The index of the tab to be active by default (0-based)
@param {String} [type="underline"] - The style type of the tabs ("underline", "pill", "card", "segment", etc.)
@param {String} [placement="top"] - The placement of the tabs ("top", "bottom", "left", "right")
Usage:
{{< tabs defaultTab="1" type="card" placement="top" >}}
{{% tab title="Tab 1" %}}
@@ -15,7 +15,7 @@
Content for Tab 2
{{% /tab %}}
{{< /tabs >}}
Note: Tabs must be defined using the nested "tab" shortcode within the "tabs" shortcode.
*/ -}}
@@ -47,7 +47,7 @@
{{- $id := $tab.id -}}
<button class="tab-button" type="button" role="tab" id="tab-{{ $id }}" aria-selected="{{ eq $index $defaultTab }}">{{ $title | $.Page.RenderString }}</button>
{{- end -}}
{{- .Inner | strings.TrimSpace | .Page.RenderString -}}
{{- .Inner -}}
</tab-container>
</div>
+3 -2
View File
@@ -2,6 +2,7 @@
* Custom code types that are not in Chroma's built-in lexer definitions.
*/
export const customCodeTypes: Record<string, string> = {
markdown: 'Markdown',
yml: 'YAML',
'go-html-template': 'Go HTML Template',
'markdown': 'Markdown',
'yml': 'YAML',
}