Skip to content

Commit 82bbfa7

Browse files
slorberclaude
andcommitted
fix(theme-classic): don't render an empty class attribute on MDX links
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c880050 commit 82bbfa7

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • packages/docusaurus-theme-classic/src/theme/MDXComponents/A

‎packages/docusaurus-theme-classic/src/theme/MDXComponents/A/index.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export default function MDXA(props: Props): ReactNode {
1515
// MDX Footnotes have ids such as <a id="user-content-fn-1-953011" ...>
1616
const anchorTargetClassName = useAnchorTargetClassName(props.id);
1717

18-
return (
19-
<Link {...props} className={clsx(anchorTargetClassName, props.className)} />
20-
);
18+
// Avoid rendering an empty class="" attribute
19+
const className = clsx(anchorTargetClassName, props.className) || undefined;
20+
21+
return <Link {...props} className={className} />;
2122
}

0 commit comments

Comments
 (0)