Skip to content

Commit 0f7726f

Browse files
Wrap headers containing inline clode (#1006)
* Wrap headers with inline clode * Use newer, shorter JS syntax
1 parent 439db55 commit 0f7726f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

components/utilities/headerLink.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ const HeaderLink = ({ name, level, className, children }) => {
3131
};
3232

3333
// Check if there's a <code> tag in the heading, so we can style it properly.
34-
// If we're getting something back, that means there is one, so we add the special class
34+
// If we're getting something back, that means there is one, so we will wrap
35+
// the header contents in <span> to prevent it from flexing
3536
const withInlineCode = Array.from(children).find(
36-
(child) => child && child.props && child.props.mdxType === "inlineCode"
37+
(child) => child?.type === "code",
3738
);
3839

3940
const Header = `h${level}`;

components/utilities/headerLink.module.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
}
44

55
.HeaderContainer {
6-
@apply items-center font-bold text-gray-90 leading-snug;
6+
@apply flex items-center font-bold text-gray-90 leading-snug;
77
overflow-wrap: anywhere;
88
}
99

0 commit comments

Comments
 (0)