Skip to content

Commit 4ee6d2a

Browse files
authored
Add admonitions (#513)
* Add codeblocks * Add copy button and fine-tune typography * fine-tuning * wip * wip * Fix spacing * Update documentation * Add colors to theme * OK * Move tests to f# tests * cleanup
1 parent 32d7e9f commit 4ee6d2a

File tree

11 files changed

+544
-162
lines changed

11 files changed

+544
-162
lines changed

docs/syntax/admonitions.md

Lines changed: 96 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,82 +7,148 @@ Admonitions allow you to highlight important information with varying levels of
77
Admonitions can span multiple lines and support inline formatting.
88
Available admonition types include:
99

10-
- Note
11-
- Warning
12-
- Tip
13-
- Important
14-
- Plain
10+
- [Note](#note)
11+
- [Warning](#warning)
12+
- [Tip](#tip)
13+
- [Important](#important)
14+
- [Plain](#plain)
1515

1616
### Note
1717

1818
A relevant piece of information with no serious repercussions if ignored.
1919

20-
```markdown
20+
21+
:::::{tab-set}
22+
23+
::::{tab-item} Output
24+
2125
:::{note}
2226
This is a note.
2327
It can span multiple lines and supports inline formatting.
2428
:::
25-
```
2629

30+
::::
31+
32+
::::{tab-item} Markdown
33+
34+
```markdown
2735
:::{note}
2836
This is a note.
37+
It can span multiple lines and supports inline formatting.
2938
:::
39+
```
40+
41+
::::
42+
43+
:::::
3044

3145
### Warning
3246

3347
You could permanently lose data or leak sensitive information.
3448

35-
```markdown
49+
:::::{tab-set}
50+
51+
::::{tab-item} Output
52+
3653
:::{warning}
3754
This is a warning.
3855
:::
39-
```
4056

57+
::::
58+
59+
::::{tab-item} Markdown
60+
61+
```markdown
4162
:::{warning}
4263
This is a warning.
4364
:::
65+
```
66+
67+
::::
68+
69+
:::::
4470

4571
### Tip
4672

4773
Advice to help users make better choices when using a feature.
4874

49-
```markdown
75+
You could permanently lose data or leak sensitive information.
76+
77+
:::::{tab-set}
78+
79+
::::{tab-item} Output
80+
5081
:::{tip}
5182
This is a tip.
5283
:::
53-
```
5484

85+
::::
86+
87+
::::{tab-item} Markdown
88+
89+
```markdown
5590
:::{tip}
5691
This is a tip.
5792
:::
93+
```
94+
95+
::::
96+
97+
:::::
5898

5999
### Important
60100

61101
Ignoring this information could impact performance or the stability of your system.
62102

63-
```markdown
103+
:::::{tab-set}
104+
105+
::::{tab-item} Output
106+
64107
:::{important}
65108
This is an important notice.
66109
:::
67-
```
68110

111+
::::
112+
113+
::::{tab-item} Markdown
114+
115+
```markdown
69116
:::{important}
70117
This is an important notice.
71118
:::
119+
```
120+
121+
::::
122+
123+
:::::
72124

73125
### Plain
74126

75127
A plain admonition is a callout with no further styling. Useful to create a callout that does not quite fit the mold of the stylized admonitions.
76128

77-
```markdown
129+
130+
131+
:::::{tab-set}
132+
133+
::::{tab-item} Output
134+
78135
:::{admonition} This is my callout
79136
It can *span* multiple lines and supports inline formatting.
80137
:::
81-
```
82138

139+
::::
140+
141+
::::{tab-item} Markdown
142+
143+
```markdown
83144
:::{admonition} This is my callout
84145
It can *span* multiple lines and supports inline formatting.
85146
:::
147+
```
148+
149+
::::
150+
151+
:::::
86152

87153
## Collapsible admonitions
88154

@@ -92,20 +158,33 @@ Collapsible admonitions are deprecated. Do not use them. Use [dropdowns](./dropd
92158

93159
Use `:open: <bool>` to make an admonition collapsible.
94160

95-
```markdown
161+
:::::{tab-set}
162+
163+
::::{tab-item} Output
164+
96165
:::{note}
97166
:open:
98167

99168
Longer content can be collapsed to take less space.
100169

101170
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
102171
:::
103-
```
104172

173+
174+
::::
175+
176+
::::{tab-item} Markdown
177+
178+
```markdown
105179
:::{note}
106180
:open:
107181

108182
Longer content can be collapsed to take less space.
109183

110184
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
111185
:::
186+
```
187+
188+
::::
189+
190+
:::::
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
@layer components {
2+
.admonition {
3+
@apply mt-4 pb-4 rounded-sm border-1;
4+
5+
.admonition-title {
6+
@apply px-4 py-2 font-bold flex items-center gap-2 rounded-t-sm;
7+
svg {
8+
@apply size-6;
9+
}
10+
}
11+
.admonition-content {
12+
@apply px-4;
13+
14+
& > *:first-child {
15+
@apply mt-3!;
16+
}
17+
}
18+
19+
&.note {
20+
@apply border-blue-elastic-40 bg-blue-elastic-10;
21+
.admonition-title {
22+
@apply text-blue-elastic-90 bg-blue-elastic-20;
23+
}
24+
}
25+
26+
&.tip {
27+
@apply border-teal-40 bg-teal-10;
28+
.admonition-title {
29+
@apply text-teal-90 bg-teal-20;
30+
}
31+
}
32+
33+
&.warning {
34+
@apply border-yellow-40 bg-yellow-10;
35+
36+
.admonition-title {
37+
@apply text-yellow-90 bg-yellow-20;
38+
}
39+
}
40+
41+
&.important {
42+
@apply border-purple-40 bg-purple-10;
43+
44+
.admonition-title {
45+
@apply text-purple-90 bg-purple-20;
46+
}
47+
}
48+
49+
&.plain {
50+
@apply border-grey-40 bg-grey-10;
51+
52+
.admonition-title {
53+
@apply text-grey-90 bg-grey-20;
54+
}
55+
}
56+
}
57+
}

src/Elastic.Markdown/Assets/markdown/code.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
@layer components {
22
.markdown-content {
3-
4-
53
.highlight {
64
@apply mt-4;
75
}
@@ -69,7 +67,7 @@
6967
bg-gray-100
7068
rounded-xs
7169
border-1
72-
border-gray-200
70+
border-gray-300
7371
inline-block
7472
text-nowrap
7573
;

src/Elastic.Markdown/Assets/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@import "./markdown/tabs.css";
88
@import "./markdown/code.css";
99
@import "./copybutton.css";
10+
@import "./markdown/admonition.css";
1011

1112
#default-search::-webkit-search-cancel-button {
1213
padding-right: calc(var(--spacing) * 2);

0 commit comments

Comments
 (0)