Skip to content

Commit

Permalink
tags: allow markdown in tab name #538
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed May 25, 2023
1 parent 547da8e commit 2b78984
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion exampleSite/content/shortcodes/tab.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ printf("Hello World!");

### Mixed content

{{% tab name="Mixed" %}}
{{% tab name="_**Mixed**_" %}}

A tab can not only contain code but arbitrary text. In this case text and code will get a margin.

Expand Down
12 changes: 6 additions & 6 deletions exampleSite/content/shortcodes/tabs.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ While pressing a tab of group A switches all tab views of group A in sync (if th
{ "Hello": "World" }
```
{{%/* /tab */%}}
{{%/* tab name="XML" */%}}
{{%/* tab name="_**XML**_ stuff" */%}}
```xml
<Hello>World</Hello>
```
Expand All @@ -117,7 +117,7 @@ Hello = World
{ "Hello": "World" }
```
{{%/* /tab */%}}
{{%/* tab name="XML" */%}}
{{%/* tab name="XML stuff" */%}}
```xml
<Hello>World</Hello>
```
Expand All @@ -133,7 +133,7 @@ Hello = World
{ "Hello": "World" }
```
{{%/* /tab */%}}
{{%/* tab name="XML" */%}}
{{%/* tab name="XML stuff" */%}}
```xml
<Hello>World</Hello>
```
Expand All @@ -152,7 +152,7 @@ Hello = World
{ "Hello": "World" }
```
{{% /tab %}}
{{% tab name="XML" %}}
{{% tab name="_**XML**_ stuff" %}}
```xml
<Hello>World</Hello>
```
Expand All @@ -172,7 +172,7 @@ Hello = World
{ "Hello": "World" }
```
{{% /tab %}}
{{% tab name="XML" %}}
{{% tab name="XML stuff" %}}
```xml
<Hello>World</Hello>
```
Expand All @@ -187,7 +187,7 @@ Hello = World
{ "Hello": "World" }
```
{{% /tab %}}
{{% tab name="XML" %}}
{{% tab name="XML stuff" %}}
```xml
<Hello>World</Hello>
```
Expand Down
8 changes: 4 additions & 4 deletions layouts/partials/shortcodes/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
<div class="tab-nav">
{{- range $idx, $tab := $tabs }}
<button
data-tab-item="{{ .name }}"
data-tab-item="{{ .name | markdownify | plainify }}"
class="tab-nav-button{{ cond (eq $idx 0) " active" ""}}"
onclick="switchTab('{{ $groupid }}','{{ .name }}')"
onclick="switchTab('{{ $groupid }}','{{ .name | markdownify | plainify}}')"
>
<span>{{ .name }}</span></button>
<span>{{ .name | markdownify }}</span></button>
{{- end }}
</div>
<div class="tab-content">
{{- range $idx, $tab := $tabs }}
<div
data-tab-item="{{ .name }}"
data-tab-item="{{ .name | markdownify | 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 ? -->
Expand Down

0 comments on commit 2b78984

Please sign in to comment.