Skip to content

Commit f24b4a2

Browse files
Add hidden demo page for deep-linking examples
- Created new hidden demo page at /docs/writing-content/demo with API documentation examples - Updated all deep-linking examples in code-blocks.mdx to link to demo page sections - Added demo page to docs.yml navigation with hidden: true flag - Demo page includes PlantClient, PlantConfig, createPlant, create_plant, fetchPlants, and PlantResponse examples Co-Authored-By: Catherine Deskur <[email protected]>
1 parent ce1142d commit f24b4a2

File tree

3 files changed

+104
-6
lines changed

3 files changed

+104
-6
lines changed

fern/products/docs/docs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ navigation:
111111
- page: Conditionally rendered content
112112
hidden: true
113113
path: ./pages/component-library/custom-components/conditional-rendering.mdx
114+
- page: Component demos
115+
hidden: true
116+
path: ./pages/component-library/demo.mdx
117+
slug: demo
114118
- section: AI features
115119
contents:
116120
- link: Ask Fern

fern/products/docs/pages/component-library/default-components/code-blocks.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ The `links` property accepts a map where keys are matching patterns (exact strin
313313

314314
<Tabs>
315315
<Tab title="Example">
316-
```typescript links={"PlantClient": "https://example.com/api/plant-client", "createPlant": "https://example.com/api/create-plant"}
316+
```typescript links={"PlantClient": "/docs/writing-content/demo#plantclient", "createPlant": "/docs/writing-content/demo#createplant"}
317317
import { PlantClient } from "@plantstore/sdk";
318318

319319
const client = new PlantClient({ apiKey: "YOUR_API_KEY" });
@@ -325,7 +325,7 @@ The `links` property accepts a map where keys are matching patterns (exact strin
325325
</Tab>
326326
<Tab title="Markdown">
327327
````markdown
328-
```typescript links={"PlantClient": "https://example.com/api/plant-client", "createPlant": "https://example.com/api/create-plant"}
328+
```typescript links={"PlantClient": "/docs/writing-content/demo#plantclient", "createPlant": "/docs/writing-content/demo#createplant"}
329329
import { PlantClient } from "@plantstore/sdk";
330330

331331
const client = new PlantClient({ apiKey: "YOUR_API_KEY" });
@@ -348,7 +348,7 @@ You can use regex patterns for more flexible matching. This is useful when you w
348348

349349
<Tabs>
350350
<Tab title="Example">
351-
```python links={"Plant\\w+": "https://example.com/api/plant-models", "create_\\w+": "https://example.com/api/create-methods"}
351+
```python links={"Plant\\w+": "/docs/writing-content/demo#type-definitions", "create_\\w+": "/docs/writing-content/demo#create_plant"}
352352
from plantstore import PlantClient, PlantConfig
353353

354354
client = PlantClient(api_key="YOUR_API_KEY")
@@ -360,7 +360,7 @@ You can use regex patterns for more flexible matching. This is useful when you w
360360
</Tab>
361361
<Tab title="Markdown">
362362
````markdown
363-
```python links={"Plant\\w+": "https://example.com/api/plant-models", "create_\\w+": "https://example.com/api/create-methods"}
363+
```python links={"Plant\\w+": "/docs/writing-content/demo#type-definitions", "create_\\w+": "/docs/writing-content/demo#create_plant"}
364364
from plantstore import PlantClient, PlantConfig
365365

366366
client = PlantClient(api_key="YOUR_API_KEY")
@@ -383,7 +383,7 @@ You can mix exact string matching and regex patterns in the same `links` map:
383383

384384
<Tabs>
385385
<Tab title="Example">
386-
```javascript links={"fetchPlants": "https://example.com/api/fetch", "Plant\\w+": "https://example.com/api/types"}
386+
```javascript links={"fetchPlants": "/docs/writing-content/demo#fetchplants", "Plant\\w+": "/docs/writing-content/demo#plantresponse"}
387387
async function fetchPlants() {
388388
const response = await fetch('/api/plants');
389389
const data: PlantResponse = await response.json();
@@ -393,7 +393,7 @@ You can mix exact string matching and regex patterns in the same `links` map:
393393
</Tab>
394394
<Tab title="Markdown">
395395
````markdown
396-
```javascript links={"fetchPlants": "https://example.com/api/fetch", "Plant\\w+": "https://example.com/api/types"}
396+
```javascript links={"fetchPlants": "/docs/writing-content/demo#fetchplants", "Plant\\w+": "/docs/writing-content/demo#plantresponse"}
397397
async function fetchPlants() {
398398
const response = await fetch('/api/plants');
399399
const data: PlantResponse = await response.json();
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
title: Component demos
3+
hidden: true
4+
---
5+
6+
This page contains demo content for testing and showcasing various documentation components. It's hidden from navigation but can be linked to from examples.
7+
8+
## API client examples
9+
10+
### PlantClient
11+
12+
The `PlantClient` class is the main entry point for interacting with the Plant Store API. It handles authentication, request management, and provides access to all API endpoints.
13+
14+
**Constructor parameters:**
15+
- `apiKey` (string, required): Your API authentication key
16+
- `baseUrl` (string, optional): Custom API base URL for testing
17+
- `timeout` (number, optional): Request timeout in milliseconds
18+
19+
**Example usage:**
20+
```typescript
21+
import { PlantClient } from "@plantstore/sdk";
22+
23+
const client = new PlantClient({
24+
apiKey: "your-api-key-here"
25+
});
26+
```
27+
28+
### PlantConfig
29+
30+
Configuration object for customizing the Plant Store SDK behavior.
31+
32+
**Properties:**
33+
- `retryAttempts` (number): Number of retry attempts for failed requests
34+
- `cacheEnabled` (boolean): Enable response caching
35+
- `logLevel` (string): Logging verbosity level
36+
37+
### createPlant
38+
39+
Creates a new plant entry in the database.
40+
41+
**Parameters:**
42+
- `name` (string, required): Common name of the plant
43+
- `species` (string, required): Scientific species name
44+
- `description` (string, optional): Plant description
45+
- `careLevel` (string, optional): Care difficulty level
46+
47+
**Returns:** Promise resolving to the created plant object
48+
49+
**Example:**
50+
```typescript
51+
const plant = await client.createPlant({
52+
name: "Monstera",
53+
species: "Monstera deliciosa",
54+
careLevel: "easy"
55+
});
56+
```
57+
58+
## API method examples
59+
60+
### create_plant
61+
62+
Python method for creating a new plant entry.
63+
64+
**Signature:**
65+
```python
66+
def create_plant(
67+
name: str,
68+
species: str,
69+
description: Optional[str] = None,
70+
care_level: Optional[str] = None
71+
) -> Plant
72+
```
73+
74+
### fetchPlants
75+
76+
Retrieves a list of plants from the API with optional filtering.
77+
78+
**Parameters:**
79+
- `filters` (object, optional): Filter criteria
80+
- `limit` (number, optional): Maximum number of results
81+
- `offset` (number, optional): Pagination offset
82+
83+
**Returns:** Promise resolving to an array of plant objects
84+
85+
## Type definitions
86+
87+
### PlantResponse
88+
89+
Response object returned from plant-related API calls.
90+
91+
**Properties:**
92+
- `plants` (Array): List of plant objects
93+
- `total` (number): Total count of plants
94+
- `hasMore` (boolean): Whether more results are available

0 commit comments

Comments
 (0)