diff --git a/components/markdown-content.tsx b/components/markdown-content.tsx index 6280a81..260efb4 100644 --- a/components/markdown-content.tsx +++ b/components/markdown-content.tsx @@ -215,11 +215,13 @@ const components: Components = { const firstHast = node?.children?.[0]; const isKeyValue = firstHast?.type === "element" && - (firstHast as Element).tagName === "strong"; + firstHast.tagName === "strong"; if (isKeyValue) { - const keyText = extractHastText(firstHast as Element); - // Skip the first rendered child (the ) — we replace it with KeyBadge. + const keyText = extractHastText(firstHast); + // Skip index 0 (the rendered element) — works because react-markdown + // emits strong as child[0] for tight lists with the `- **Key:** value` pattern. + // Tight lists only: loose lists wrap content in

, changing the HAST structure. const rest = React.Children.toArray(children).slice(1); return (

  • ( - - {children} - - ), + a: ({ href, children }) => { + const isExternal = !!href && /^https?:\/\//.test(href); + return ( + + {children} + + ); + }, strong: ({ children }) => ( {children}