diff --git a/src/components/DocLink.astro b/src/components/DocLink.astro
index a39e8551..29e316c1 100644
--- a/src/components/DocLink.astro
+++ b/src/components/DocLink.astro
@@ -3,13 +3,14 @@ import { getLinkToKey } from "../lib/doc-index";
interface Props {
src: string;
+ section?: string;
}
-const { src } = Astro.props;
+const { src, section } = Astro.props;
const rawLink = await getLinkToKey(src);
const missing = rawLink === undefined;
-const link = rawLink ?? "";
+const link = rawLink ? rawLink + (section ? "#" + section : "") : "";
---
{
diff --git a/src/content/docs/development/guide/component-docs-for-llm.mdx b/src/content/docs/development/guide/component-docs-for-llm.mdx
index dd297791..804eeb29 100644
--- a/src/content/docs/development/guide/component-docs-for-llm.mdx
+++ b/src/content/docs/development/guide/component-docs-for-llm.mdx
@@ -234,7 +234,8 @@ The `DocLink` component renders an inline link to a page associated with a doc k
#### Props
-- `src` (required): The doc key (e.g., `"cpp.library.utilities.move"`) or absolute path (e.g., `"/cpp/library/utilities/move"`).
+- `src` (required): The absolute path (e.g., `"/cpp/library/utilities/move"`).
+- `section` (optional): The `id` of the HTML element to jump to, typically the `id` of heading tags generated from Markdown headings.
#### Slots
diff --git a/src/content/docs/development/guide/doc-everything.mdx b/src/content/docs/development/guide/doc-everything.mdx
index e9994bc2..dbe63e52 100644
--- a/src/content/docs/development/guide/doc-everything.mdx
+++ b/src/content/docs/development/guide/doc-everything.mdx
@@ -357,6 +357,26 @@ for more information about `std::move`.
Check out this page for more information about `std::move`.
+By setting the `section` attribute, you can link to a specific section (or any HTML elements with corresponding `id` attribute) of a CppDoc page.
+
+```mdx
+import DocLink from "@components/DocLink.astro";
+
+Standard library hardening
+allows turning some instances of undefined behavior in the standard library
+into a contract violation.
+```
+
+
+ Standard library hardening
+ allows turning some instances of undefined behavior in the standard library
+ into a contract violation.
+
+