();
visit(tree, 'definition', (node: Definition) => {
definitions.set(node.identifier, node.url);
});
+ // Mark multiline blocks as SemBr examples for whitespace styling.
visit(tree, 'html', (node) => {
const match = node.value.match(MULTILINE_PRE_PATTERN);
if (
@@ -70,6 +72,39 @@ export const remarkSembr: Plugin<[], Root> = () => {
}
});
+ // FAQ comparison table: accessible support indicators and styled "None".
+ visit(tree, 'tableCell', (node) => {
+ if (node.children.length !== 1 || node.children[0]?.type !== 'text') {
+ return;
+ }
+ const value = node.children[0].value;
+ if (value === 'Supported') {
+ node.children = [
+ {
+ type: 'html',
+ value:
+ '✓',
+ },
+ ];
+ } else if (value === 'Not supported') {
+ node.children = [
+ {
+ type: 'html',
+ value:
+ '✗',
+ },
+ ];
+ } else if (value === 'None') {
+ node.children = [
+ {
+ type: 'html',
+ value: 'None',
+ },
+ ];
+ }
+ });
+
+ // Keep "Line Breaks" on one line in the title via a non-breaking space.
visit(tree, 'heading', (node) => {
if (
node.depth === 1 &&
@@ -81,13 +116,14 @@ export const remarkSembr: Plugin<[], Root> = () => {
}
});
+ // Highlight RFC 2119 keywords and normalize --- to an em dash.
visit(tree, 'text', (node, index, parent) => {
if (!parent || typeof index !== 'number') {
return;
}
const value = node.value.replace(EM_DASH_PATTERN, EM_DASH);
- const matches = [...value.matchAll(KEYWORD_PATTERN)];
+ const matches = [...value.matchAll(RFC_2119_PATTERN)];
if (matches.length === 0) {
if (value !== node.value) {
@@ -124,6 +160,7 @@ export const remarkSembr: Plugin<[], Root> = () => {
parent.children.splice(index, 1, ...(nodes as typeof parent.children));
});
+ // Prefix Creative Commons license links with Unicode license symbols.
visit(tree, ['link', 'linkReference'], (node, index, parent) => {
if (!parent || typeof index !== 'number') {
return;
diff --git a/src/styles/global.css b/src/styles/global.css
index fc2c741..a9a43ed 100644
--- a/src/styles/global.css
+++ b/src/styles/global.css
@@ -185,6 +185,7 @@
position: relative;
padding-inline-start: var(--space-s);
margin-block-end: var(--space-s);
+ text-wrap: balance;
}
ol>li::marker {
@@ -379,11 +380,15 @@
font-weight: 700;
}
- mark[data-supported="true"] {
+ tbody tr>td:nth-child(2) {
+ text-wrap: balance;
+ }
+
+ :is(mark, em)[data-supported="true"] {
color: var(--color-heading);
}
- mark[data-supported="false"] {
+ :is(mark, em)[data-supported="false"] {
color: var(--color-rule);
}