From bdc0e211cd1049c53b1ab59024d9e41836792c3b Mon Sep 17 00:00:00 2001 From: Sudrut Date: Thu, 11 Dec 2025 15:57:43 +0800 Subject: [PATCH 1/2] feat: add component NamedReq --- src/components/NamedReq.astro | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/components/NamedReq.astro diff --git a/src/components/NamedReq.astro b/src/components/NamedReq.astro new file mode 100644 index 00000000..d728fab5 --- /dev/null +++ b/src/components/NamedReq.astro @@ -0,0 +1,37 @@ +--- +import DocLink from "./DocLink.astro"; + +interface Props { + name: string; + bold?: boolean; + displayName?: string; + nolink?: boolean; +} + +const { name, bold, displayName, nolink } = Astro.props; +const src = `/cpp/named_req/${name}`; + +const text = displayName ?? name; + +const As = nolink ? Fragment : DocLink; +const asProps = nolink ? {} : { src }; +--- + + + + {text} + + + + From 985912714ab635b4ff9494bbf65f63802dfc0ca7 Mon Sep 17 00:00:00 2001 From: Sudrut Date: Thu, 11 Dec 2025 16:04:14 +0800 Subject: [PATCH 2/2] feat: add docs for NamedReq --- .../guide/component-docs-for-llm.mdx | 20 +++++++++++ .../docs/development/guide/doc-everything.mdx | 35 +++++++++++++++++++ 2 files changed, 55 insertions(+) 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 b74da26a..dd297791 100644 --- a/src/content/docs/development/guide/component-docs-for-llm.mdx +++ b/src/content/docs/development/guide/component-docs-for-llm.mdx @@ -288,6 +288,26 @@ import { CppHeader } from "@components/header"; Base component for `CHeader` and `CppHeader`. Not used directly. +### NamedReq + +The `NamedReq` component renders an inline link to a named requirement. + +#### Props + +- `name` (required): The name of the requirement. +- `bold` (optional): If `true`, the text renders bold. +- `displayName` (optional): Custom display text. +- `nolink` (optional): If `true`, renders as plain text without a link. + +#### Usage + + +import NamedReq from "@components/NamedReq.astro" + +A type is the type of an object +that can be used on the left of the function call operator. + + ## Feature Test Macros ### FeatureTestMacro diff --git a/src/content/docs/development/guide/doc-everything.mdx b/src/content/docs/development/guide/doc-everything.mdx index ad5c2f5e..e9994bc2 100644 --- a/src/content/docs/development/guide/doc-everything.mdx +++ b/src/content/docs/development/guide/doc-everything.mdx @@ -13,6 +13,7 @@ import DocLink from "@components/DocLink.astro"; import { DR, DRList } from "@components/defect-report"; import { FeatureTestMacro, FeatureTestMacroValue } from "@components/feature-test-macro"; import Missing from "@components/Missing.astro"; +import NamedReq from "@components/NamedReq.astro" import { ParamDoc, ParamDocList } from "@components/param-doc"; import { RevisionBlock } from "@components/revision"; @@ -384,6 +385,40 @@ Entities in it can be used in a C++ program by including the header If documentation for the specified header does not exist yet, the `CHeader` and the `CppHeader` component will render the header name as plain text without a link. +### Link to Named Requirement + +The `NamedReq` component renders an inline link to the documentation page of a named requirement. + +```mdx +import NamedReq from "@components/NamedReq.astro"; + +A type is the type of an object +that can be used on the left of the function call operator. +``` + + + A type is the type of an object + that can be used on the left of the function call operator. + + +You can set the `bold` attribute to `true`, to make the requirement name appear in bold. + +```mdx +import NamedReq from "@components/NamedReq.astro"; + +A type is the type of an object +that can be used on the left of the function call operator. +``` + + + A type is the type of an object + that can be used on the left of the function call operator. + + + + ## Feature Test Macros The `FeatureTestMacro` component renders to a box that shows information about a feature test macro.