Skip to content

Commit 6ed0d2a

Browse files
committed
[Docs Site] WranglerCommand improvements
1 parent a7e17a5 commit 6ed0d2a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/components/WranglerCommand.astro

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import AnchorHeading from "./AnchorHeading.astro";
55
import { PackageManagers } from "starlight-package-managers";
66
import WranglerArg from "./WranglerArg.astro";
77
import Details from "./Details.astro";
8+
import { marked } from "marked";
89
910
function getCommand(path: string) {
1011
const segments = path.trim().split(/\s+/);
@@ -37,6 +38,8 @@ let { command, headingLevel, description } = props.parse(Astro.props);
3738
3839
const definition = getCommand(command);
3940
41+
description ??= definition.metadata.description;
42+
4043
if (!definition.args) {
4144
throw new Error(`[WranglerCommand] "${command}" has no arguments`);
4245
}
@@ -48,9 +51,9 @@ const positionals = definition.positionalArgs
4851
.join(" ");
4952
---
5053

51-
<AnchorHeading depth={headingLevel} title={command} />
54+
<AnchorHeading depth={headingLevel} title={`\`${command}\``} />
5255

53-
<p>{description ? description : definition.metadata.description}</p>
56+
<Fragment set:html={marked.parse(description)} />
5457

5558
<PackageManagers
5659
pkg="wrangler"

src/content/docs/style-guide/components/wrangler-command.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ import { WranglerCommand } from "~/components";
2121
```mdx live
2222
import { WranglerCommand } from "~/components";
2323

24-
<WranglerCommand command="deploy" />
24+
<WranglerCommand
25+
command="deploy"
26+
description={"Deploy a [Worker](/workers/)"}
27+
/>
2528

2629
<WranglerCommand command="d1 execute" />
2730
```
@@ -33,4 +36,4 @@ import { WranglerCommand } from "~/components";
3336
- `headingLevel` <Type text="boolean" /> <MetaInfo text="(default: 2) optional" />
3437
- The heading level that the command name should be added at on the page, i.e `2` for a `h2`.
3538
- `description` <Type text="string" /> <MetaInfo text="optional" />
36-
- A description to render below the command heading. If not set, defaults to the value specified in the Wrangler help API.
39+
- A description to render below the command heading. If not set, defaults to the value specified in the Wrangler help API.

0 commit comments

Comments
 (0)