+29
-26
rehype-custom-html.ts
+29
-26
rehype-custom-html.ts
···
126
126
127
127
case "p": {
128
128
if (node.children[0].type === "text") para(node.children[0], node);
129
-
130
129
forChild(node.children);
130
+
break;
131
131
}
132
132
133
133
case "pre": {
···
135
135
if (node.properties["tabindex"]) node.properties["tabindex"] = "-1";
136
136
}
137
137
138
-
case "ul": {
139
-
node.children.forEach((x) => {
140
-
if (x.type === "element" && x.tagName === "li") {
141
-
const contents = x.children.map((y) => {
142
-
if (
143
-
y.type === "element" &&
144
-
y.tagName === "input" &&
145
-
y.properties.type === "checkbox"
146
-
)
147
-
y.properties["aria-label"] = y.properties.checked
148
-
? "Checked checkbox"
149
-
: "Unchecked checkbox";
150
-
return y;
151
-
});
138
+
case "ul":
139
+
{
140
+
node.children.forEach((x) => {
141
+
if (x.type === "element" && x.tagName === "li") {
142
+
const contents = x.children.map((y) => {
143
+
if (
144
+
y.type === "element" &&
145
+
y.tagName === "input" &&
146
+
y.properties.type === "checkbox"
147
+
)
148
+
y.properties["aria-label"] = y.properties.checked
149
+
? "Checked checkbox"
150
+
: "Unchecked checkbox";
151
+
return y;
152
+
});
153
+
154
+
x.children = [
155
+
{
156
+
type: "element",
157
+
tagName: "label",
158
+
properties: {},
159
+
children: contents,
160
+
},
161
+
];
162
+
}
163
+
});
164
+
}
152
165
153
-
x.children = [
154
-
{
155
-
type: "element",
156
-
tagName: "label",
157
-
properties: {},
158
-
children: contents,
159
-
},
160
-
];
161
-
}
162
-
});
163
-
}
166
+
break;
164
167
}
165
168
}
166
169
};