Skip to content

Commit a9e49c0

Browse files
iadawnkfranqueiro
andauthored
Add title and styling to examples (#4093)
Fixes #2958 Change styling for examples within the Key Terms section to include text to indicate it is an example and a background change to make it stand out. <img width="930" alt="example of styling for key terms example" src="https://github.com/user-attachments/assets/3d935218-4475-4d21-b856-bec20ab9a379"> --------- Co-authored-by: Kenneth G. Franqueiro <kfranqueiro@users.noreply.github.com>
1 parent 7e0f5ea commit a9e49c0

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

11ty/CustomLiquid.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,12 @@ export class CustomLiquid extends Liquid {
507507
<p>${$el.html()}</p>
508508
</div>`);
509509
});
510+
511+
// Add header to example sections in Key Terms (aside) and Conformance (div)
512+
$("aside.example, div.example").each((_, el) => {
513+
const $el = $(el);
514+
$el.prepend(`<p class="example-title marker">Example</p>`);
515+
});
510516

511517
// We don't need to do any more processing for index/about pages other than stripping comments
512518
if (indexPattern.test(scope.page.inputPath)) return stripHtmlComments($.html());

css/base.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,19 @@ dt div {
155155
margin-top: 0;
156156
}
157157

158+
:is(aside, div).example .example-title {
159+
font-weight: bold;
160+
margin: 0;
161+
}
162+
:is(aside, div).example {
163+
padding: 1em 1em 0.5em 1em;
164+
margin-bottom: 1em;
165+
border-left-width: .5em;
166+
border-left-style: solid;
167+
border-color: #e0cb52;
168+
background: #fcfaee
169+
}
170+
158171
.obsolete {
159172
border-left: solid 5px var(--faded-red);
160173
}

0 commit comments

Comments
 (0)