Skip to content

Commit 54c0f65

Browse files
committed
update styling
1 parent 1ae90f5 commit 54c0f65

File tree

4 files changed

+79
-10
lines changed

4 files changed

+79
-10
lines changed

docs/syntax/applies.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,43 @@ stack: ga 9.1
153153
````
154154

155155
This will allow the yaml inside the `{applies-to}` directive to be fully highlighted.
156+
157+
158+
## Examples
159+
160+
#### Stack only
161+
```yaml {applies_to}
162+
stack: ga 9.1
163+
```
164+
165+
#### Stack with deployment
166+
```yaml {applies_to}
167+
stack: ga 9.1
168+
deployment:
169+
eck: ga 9.0
170+
ess: beta 9.1
171+
```
172+
173+
#### Deployment only
174+
```yaml {applies_to}
175+
deployment:
176+
ece: discontinued 9.2.0
177+
self: unavailable 9.3.0
178+
```
179+
180+
#### Serverless only
181+
```yaml {applies_to}
182+
serverless: ga 9.0.0
183+
```
184+
185+
#### Serverless with project differences
186+
```yaml {applies_to}
187+
serverless:
188+
security: ga 9.0.0
189+
elasticsearch: beta 9.1.0
190+
observability: discontinued 9.2.0
191+
```
192+
#### Stack with product
193+
```yaml {applies_to}
194+
stack: ga 9.1
195+
```

src/Elastic.Markdown/Assets/styles.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,30 @@
8787
.content-container {
8888
@apply w-full max-w-[80ch];
8989
}
90+
91+
.applies {
92+
border-bottom: 1px solid var(--color-gray-300);
93+
padding-bottom: calc(var(--spacing) * 3);
94+
font-family: "Mier B", "Inter", sans-serif;
95+
96+
.applies-to-label {
97+
display: block;
98+
font-size: 1.5em;
99+
font-weight: var(--font-weight-extrabold);
100+
padding-bottom: calc(var(--spacing) * 3);
101+
}
102+
.applicable-info {
103+
padding: calc(var(--spacing) * 0.5);
104+
padding-left: calc(var(--spacing) * 2);
105+
padding-right: calc(var(--spacing) * 2);
106+
margin: calc(var(--spacing) * 0.5);
107+
display: inline-block;
108+
font-size: 0.8em;
109+
border-radius: 0.4em;
110+
background-color: var(--color-white);
111+
border: 1px solid var(--color-gray-300);
112+
}
113+
}
90114
}
91115

92116
* {

src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockParser.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,16 @@ private static void ProcessAppliesToDirective(AppliesToDirective appliesToDirect
111111
{
112112
var yaml = lines.ToSlice().AsSpan().ToString();
113113

114-
var applicableTo = YamlSerialization.Deserialize<ApplicableTo>(yaml);
115-
appliesToDirective.AppliesTo = applicableTo;
114+
try
115+
{
116+
var applicableTo = YamlSerialization.Deserialize<ApplicableTo>(yaml);
117+
appliesToDirective.AppliesTo = applicableTo;
118+
119+
}
120+
catch (Exception e)
121+
{
122+
appliesToDirective.EmitError($"Unable to parse applies_to directive: {yaml}", e);
123+
}
116124
}
117125

118126
private static void ProcessCallOuts(StringLineGroup lines, string language, EnhancedCodeBlock codeBlock,

src/Elastic.Markdown/Slices/Directives/ApplicableTo.cshtml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
@using Elastic.Markdown.Myst.FrontMatter
22
@inherits RazorSlice<Elastic.Markdown.Myst.FrontMatter.ApplicableTo>
3-
<p class="product-availability">
4-
<span class="applies-to-label sd-badge sd-outline-transparent sd-text-black">
5-
Applies To:
6-
</span>
3+
<p class="applies">
4+
<span class="applies-to-label"></span>
75
@if (Model.Stack is not null)
86
{
97
@RenderProduct("Elastic Stack", Model.Stack)
108
}
11-
129
@if (Model.Deployment is not null)
1310
{
1411
if (Model.Deployment.Ece is not null)
@@ -108,15 +105,15 @@
108105
foreach (var applicability in applications)
109106
{
110107
var c = GetLifeCycleClass(applicability.Lifecycle);
111-
<span class="sd-badge sd-outline-@c sd-text-@c applies-badge">
108+
<span class="applicable-info">
112109
@name
113110
@if (applicability.Lifecycle != ProductLifecycle.GenerallyAvailable)
114111
{
115-
<span class="sd-text-secondary">@GetLifeCycleName(applicability.Lifecycle)</span>
112+
<span class="text-emerald-500">@GetLifeCycleName(applicability.Lifecycle)</span>
116113
}
117114
@if (applicability.Version is not null and not AllVersions)
118115
{
119-
<span class="sd-text-success">(@applicability.Version)</span>
116+
<span class="text-red-70">(@applicability.Version)</span>
120117
}
121118
</span>
122119
}

0 commit comments

Comments
 (0)