diff --git a/src/components/Glossary/GlossaryDefinition/index.tsx b/src/components/Glossary/GlossaryDefinition/index.tsx
index fa98723d8b9..4166449b07e 100644
--- a/src/components/Glossary/GlossaryDefinition/index.tsx
+++ b/src/components/Glossary/GlossaryDefinition/index.tsx
@@ -1,6 +1,7 @@
import { ComponentProps } from "react"
-import { Box, Text } from "@chakra-ui/react"
+import { Box, type HeadingProps, Text } from "@chakra-ui/react"
+import IdAnchor from "@/components/IdAnchor"
import InlineLink from "@/components/Link"
import OldHeading from "@/components/OldHeading"
import Translation from "@/components/Translation"
@@ -24,22 +25,38 @@ const GlossaryDefinition = ({
size = "md",
options = { ns: DEFAULT_GLOSSARY_NS },
}: GlossaryDefinitionProps) => {
- const headingStyles =
- size === "sm"
- ? { fontSize: "md", mt: 0, mb: 2 }
- : { fontSize: { base: "xl", md: "2xl" } }
-
const textStyles = size === "sm" ? { mb: 0 } : {}
+ const headingPropsForAnchor = (id?: string): HeadingProps => {
+ if (!id) return {}
+ return {
+ scrollMarginTop: 28,
+ id,
+ "data-group": true,
+ position: "relative",
+ } as HeadingProps
+ }
+ const commonHeadingProps = (id?: string): HeadingProps => ({
+ fontWeight: 700,
+ lineHeight: 1.4,
+ ...headingPropsForAnchor(id),
+ })
+ const Heading3 = ({ id, children, ...rest }: HeadingProps) => (
+
+
+ {children}
+
+ )
+
return (
-
+
-
+
{/**
* `as="span"` prevents hydration warnings for strings that contain
* elements that cannot be nested inside `p` tags, like `ul` tags
diff --git a/src/components/IdAnchor.tsx b/src/components/IdAnchor.tsx
new file mode 100644
index 00000000000..72569a8bed2
--- /dev/null
+++ b/src/components/IdAnchor.tsx
@@ -0,0 +1,24 @@
+import { CiLink } from "react-icons/ci"
+import { Icon } from "@chakra-ui/react"
+
+import Link from "@/components/Link"
+
+const IdAnchor = ({ id }: { id?: string }) => {
+ if (!id) return null
+ return (
+
+
+
+ )
+}
+
+export default IdAnchor
diff --git a/src/components/MdComponents.tsx b/src/components/MdComponents.tsx
index e8baa592c41..fe8182f787f 100644
--- a/src/components/MdComponents.tsx
+++ b/src/components/MdComponents.tsx
@@ -1,16 +1,13 @@
import { ComponentProps } from "react"
-import { CiLink } from "react-icons/ci"
import {
Badge,
Box,
type BoxProps,
- calc,
chakra,
Divider as ChakraDivider,
Flex,
type FlexProps,
type HeadingProps,
- Icon,
ListItem,
OrderedList,
Text,
@@ -25,7 +22,6 @@ import ButtonDropdown, {
} from "@/components/ButtonDropdown"
import { ButtonLink } from "@/components/Buttons"
import Contributors from "@/components/Contributors"
-import Link from "@/components/Link"
import MarkdownImage from "@/components/MarkdownImage"
import OldHeading from "@/components/OldHeading"
import { mdxTableComponents } from "@/components/Table"
@@ -40,6 +36,7 @@ import DocLink from "./DocLink"
import Emoji from "./Emoji"
import ExpandableCard from "./ExpandableCard"
import FeaturedText from "./FeaturedText"
+import IdAnchor from "./IdAnchor"
import InfoBanner from "./InfoBanner"
import IssuesList from "./IssuesList"
import LocaleDateTime from "./LocaleDateTime"
@@ -65,24 +62,6 @@ export const commonHeadingProps = (id?: string): HeadingProps => ({
...headingPropsForAnchor(id),
})
-const IdAnchor = ({ id }: { id?: string }) => {
- if (!id) return null
- return (
-
-
-
- )
-}
-
export const Heading1 = ({ children, ...rest }: HeadingProps) => (
{children}