Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/components/NamedReq.astro
Original file line number Diff line number Diff line change
@@ -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 };
---

<As {...asProps}>
<span class=`named-req${bold ? "-bold" : ""}`>
{text}
</span>
</As>

<style>
.named-req {
font-weight: normal;
font-style: italic;
font-family: Georgia, "DejaVu Serif", serif;
}
.named-req-bold {
font-weight: bold;
font-style: italic;
font-family: Georgia, "DejaVu Serif", serif;
}
</style>
20 changes: 20 additions & 0 deletions src/content/docs/development/guide/component-docs-for-llm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <NamedReq name="FunctionObject" /> type is the type of an object
that can be used on the left of the function call operator.


## Feature Test Macros

### FeatureTestMacro
Expand Down
35 changes: 35 additions & 0 deletions src/content/docs/development/guide/doc-everything.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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.
</Aside>

### 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 <NamedReq name="FunctionObject" /> type is the type of an object
that can be used on the left of the function call operator.
```

<Card title="Preview">
A <NamedReq name="FunctionObject" /> type is the type of an object
that can be used on the left of the function call operator.
</Card>

You can set the `bold` attribute to `true`, to make the requirement name appear in bold.

```mdx
import NamedReq from "@components/NamedReq.astro";

A <NamedReq name="FunctionObject" bold /> type is the type of an object
that can be used on the left of the function call operator.
```

<Card title="Preview">
A <NamedReq name="FunctionObject" bold /> type is the type of an object
that can be used on the left of the function call operator.
</Card>

<Aside type="tip">
If documentation for the specified named requirement does not exist yet, the `NamedReq` component will render the requirement name as plain text without a link.
</Aside>

## Feature Test Macros

The `FeatureTestMacro` component renders to a box that shows information about a feature test macro.
Expand Down