Skip to content

Commit d381372

Browse files
committed
fixup!
1 parent dd5e23c commit d381372

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/generators/jsx-ast/utils/buildContent.mjs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,20 @@ export const transformHeadingNode = (entry, remark, node, index, parent) => {
178178
createChangeElement(entry, remark)
179179
);
180180

181-
if (entry.api === 'deprecations') {
181+
if (entry.api === 'deprecations' && node.depth === 3) {
182182
// On the 'deprecations.md' page, "Type: <XYZ>" turns into an AlertBox
183-
const typeNode = parent.children[index + 1];
184-
if (typeNode) {
185-
parent.children[index + 1] = createJSXElement(JSX_IMPORTS.AlertBox.name, {
186-
children: slice(typeNode, TYPE_PREFIX_LENGTH, undefined, {
183+
parent.children[index + 1] = createJSXElement(JSX_IMPORTS.AlertBox.name, {
184+
children: slice(
185+
parent.children[index + 1],
186+
TYPE_PREFIX_LENGTH,
187+
undefined,
188+
{
187189
textHandling: { boundaries: 'preserve' },
188-
}).node.children,
189-
level: 'danger',
190-
title: 'Type',
191-
});
192-
}
190+
}
191+
).node.children,
192+
level: 'danger',
193+
title: 'Type',
194+
});
193195
}
194196

195197
// Add source link element if available, right after heading

0 commit comments

Comments
 (0)