Skip to content

Commit b9c6c62

Browse files
committed
docs: add examples to use callouts and tabs
1 parent a1fb3c1 commit b9c6c62

File tree

1 file changed

+150
-0
lines changed

1 file changed

+150
-0
lines changed

docs/tabs_demo.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
---
2+
title: Documentation Features Tutorial
3+
nav_exclude: true
4+
---
5+
6+
# Documentation Features Tutorial
7+
{: .no_toc}
8+
9+
10+
## Table of Contents
11+
{: .no_toc .text-delta}
12+
13+
1. TOC
14+
{:toc}
15+
16+
## Callouts
17+
18+
You can use blockquotes with specific classes to create callouts for notes, warnings, and other important information.
19+
20+
### Syntax
21+
22+
Use the following syntax:
23+
24+
```markdown
25+
> **Label:** Your text here.
26+
{: .class-name }
27+
```
28+
29+
### Available Classes
30+
31+
#### Note
32+
```markdown
33+
> **Note:** This is a note.
34+
{: .note }
35+
```
36+
> **Note:** This is a note.
37+
{: .note }
38+
39+
#### Important
40+
```markdown
41+
> **Important:** This is important information.
42+
{: .important }
43+
```
44+
> **Important:** This is important information.
45+
{: .important }
46+
47+
#### Warning
48+
```markdown
49+
> **Warning:** This is a warning.
50+
{: .warning }
51+
```
52+
> **Warning:** This is a warning.
53+
{: .warning }
54+
55+
#### Tip
56+
```markdown
57+
> **Tip:** This is a helpful tip.
58+
{: .tip }
59+
```
60+
> **Tip:** This is a helpful tip.
61+
{: .tip }
62+
63+
#### Caution
64+
```markdown
65+
> **Caution:** Proceed with caution.
66+
{: .caution }
67+
```
68+
> **Caution:** Proceed with caution.
69+
{: .caution }
70+
71+
## Code Tabs
72+
73+
### Structure
74+
75+
The structure consists of a container `div` with class `code-tabs`, a header `div` with class `tab-header` containing buttons, and multiple content `div`s with class `tab-content`.
76+
77+
**Key Requirements:**
78+
1. **Container:** `<div class="code-tabs">`
79+
2. **Header:** `<div class="tab-header">` containing `<button>` elements.
80+
3. **Buttons:** Each button must have a `data-tab` attribute (e.g., `data-tab="python"`). One button should have the class `active`.
81+
4. **Content:** Each content div must have the class `tab-content` and a matching `data-tab` attribute. The default active tab must also have the class `active`.
82+
5. **Markdown Parsing:** Add `markdown="1"` to the content divs to ensure the code blocks inside are parsed correctly.
83+
84+
### Example
85+
86+
<div class="code-tabs">
87+
<div class="tab-header">
88+
<button class="active" data-tab="python">Python</button>
89+
<button data-tab="r">R</button>
90+
<button data-tab="curl">cURL</button>
91+
</div>
92+
93+
<div class="tab-content active" data-tab="python" markdown="1">
94+
95+
```python
96+
import pandas as pd
97+
```
98+
99+
</div>
100+
101+
<div class="tab-content" data-tab="r" markdown="1">
102+
103+
```r
104+
library(covidcast)
105+
```
106+
</div>
107+
108+
<div class="tab-content" data-tab="curl" markdown="1">
109+
110+
```bash
111+
curl ...
112+
```
113+
</div>
114+
</div>
115+
116+
### Source Code for Example
117+
118+
```html
119+
<div class="code-tabs">
120+
<div class="tab-header">
121+
<button class="active" data-tab="python">Python</button>
122+
<button data-tab="r">R</button>
123+
<button data-tab="curl">cURL</button>
124+
</div>
125+
126+
<div class="tab-content active" data-tab="python" markdown="1">
127+
128+
```python
129+
import pandas as pd
130+
```
131+
132+
</div>
133+
134+
<div class="tab-content" data-tab="r" markdown="1">
135+
136+
```r
137+
library(covidcast)
138+
```
139+
140+
</div>
141+
142+
<div class="tab-content" data-tab="curl" markdown="1">
143+
144+
```bash
145+
curl ...
146+
```
147+
148+
</div>
149+
</div>
150+
```

0 commit comments

Comments
 (0)