Skip to content

Commit b1b7945

Browse files
committed
small updates for clarity
1 parent 2f0c886 commit b1b7945

File tree

2 files changed

+55
-28
lines changed

2 files changed

+55
-28
lines changed

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

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: 'Code Blocks'
33
description: 'Learn how to enhance your documentation with customizable code blocks featuring syntax highlighting, line highlighting, focusing, and more.'
4+
max-toc-depth: 2
45
---
56

67
Fern uses [Shiki](https://shiki.matsu.io/) for syntax highlighting in code blocks.
@@ -303,7 +304,7 @@ To disable scrolling and wrap overflow onto the next line, use the `wordWrap` pr
303304
</Tabs>
304305

305306

306-
## Deep-linking
307+
## Deep linking
307308

308309
You can make specific text within code blocks clickable by defining a `links` map. This is useful for linking to documentation, API references, or related resources directly from your code examples.
309310

@@ -345,55 +346,57 @@ The `links` property accepts a map where keys are matching patterns (exact strin
345346
```
346347
</CodeBlock>
347348
````
348-
349-
<Note>
350-
The `links` property uses JSON format. Each key in the map is matched exactly against text in the code block, and matching text becomes a clickable link to the corresponding URL.
351-
</Note>
352349
</Tab>
353350
</Tabs>
354351

352+
<Note>
353+
The `links` property uses JSON format. Each key in the map is matched exactly against text in the Code Block, and matching text becomes a clickable link to the corresponding URL.
354+
</Note>
355+
355356
### Regex pattern matching
356357

357-
You can use regex patterns for more flexible matching. This is useful when you want to link multiple variations or patterns of text.
358+
You can use regex patterns for more flexible matching. This is useful when you want to link multiple variations or patterns of text.
359+
360+
In the example below, the pattern `/get\\w+/` matches both `getPlant` and `getGarden`, while `/Plant(Store|Client)/` matches both `PlantStore` and `PlantClient`.
358361

359362
<Tabs>
360363
<Tab title="Example">
361364
<CodeBlock
362-
links={{"/Plant\\w+/": "/docs/writing-content/demo#type-definitions", "/create_\\w+/": "/docs/writing-content/demo#create_plant"}}
365+
links={{"/get\\w+/": "/learn/docs/writing-content/demo#get-methods", "/Plant(Store|Client)/": "/learn/docs/writing-content/demo#type-definitions"}}
363366
>
364367
```python
365-
from plantstore import PlantClient, PlantConfig
368+
from plantstore import PlantStore, PlantClient
366369

367-
client = PlantClient(api_key="YOUR_API_KEY")
368-
plant = client.create_plant(
369-
name="Fiddle Leaf Fig",
370-
species="Ficus lyrata"
371-
)
370+
store = PlantStore(api_key="YOUR_API_KEY")
371+
client = PlantClient(store)
372+
373+
plant = store.getPlant(plant_id="123")
374+
garden = store.getGarden(garden_id="456")
372375
```
373376
</CodeBlock>
374377
</Tab>
375378
<Tab title="Markdown">
376379
````markdown
377380
<CodeBlock
378-
links={{"/Plant\\w+/": "/docs/writing-content/demo#type-definitions", "/create_\\w+/": "/docs/writing-content/demo#create_plant"}}
381+
links={{"/get\\w+/": "/learn/docs/writing-content/demo#get-methods", "/Plant(Store|Client)/": "/learn/docs/writing-content/demo#type-definitions"}}
379382
>
380-
```python
381-
from plantstore import PlantClient, PlantConfig
382-
383-
client = PlantClient(api_key="YOUR_API_KEY")
384-
plant = client.create_plant(
385-
name="Fiddle Leaf Fig",
386-
species="Ficus lyrata"
387-
)
383+
```python
384+
from plantstore import PlantStore, PlantClient
385+
386+
store = PlantStore(api_key="YOUR_API_KEY")
387+
client = PlantClient(store)
388+
389+
plant = store.getPlant(plant_id="123")
390+
garden = store.getGarden(garden_id="456")
388391
```
389392
</CodeBlock>
390393
````
394+
</Tab>
395+
</Tabs>
391396

392-
<Note>
397+
<Note>
393398
When using regex patterns, remember to escape special characters with double backslashes (e.g., `\\w+`, `\\d+`) in the JSON string.
394399
</Note>
395-
</Tab>
396-
</Tabs>
397400

398401
## Combining props
399402

@@ -403,7 +406,7 @@ a maximum height, and clickable links.
403406

404407
<Tabs>
405408
<Tab title="Example">
406-
```javascript title="Hello, World!" {6-8} maxLines=5 startLine={4}
409+
```javascript title="Hello, World!" {6-8} maxLines=5 startLine={4} links={{"console": "/learn/docs/writing-content/demo"}}
407410
console.log("Line 1");
408411
console.log("Line 2");
409412
console.log("Line 3");
@@ -417,8 +420,8 @@ a maximum height, and clickable links.
417420
```
418421
</Tab>
419422
<Tab title = "Markdown">
420-
````markdown maxLines=5
421-
```javascript title="Hello, World!" {6-8} maxLines=5 startLine={4}
423+
````markdown
424+
```javascript title="Hello, World!" {6-8} maxLines=5 startLine={4} links={{"console": "/learn/docs/writing-content/demo"}}
422425
console.log("Line 1");
423426
console.log("Line 2");
424427
console.log("Line 3");

fern/products/docs/pages/component-library/demo.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,21 @@ Retrieves a list of plants from the API with optional filtering.
8484

8585
## Type definitions
8686

87+
### PlantStore
88+
89+
The `PlantStore` class manages plant data storage and retrieval operations.
90+
91+
**Constructor parameters:**
92+
- `apiKey` (string, required): Your API authentication key
93+
- `config` (PlantConfig, optional): Configuration options
94+
95+
### PlantClient
96+
97+
The `PlantClient` class provides a client interface for interacting with PlantStore.
98+
99+
**Constructor parameters:**
100+
- `store` (PlantStore, required): PlantStore instance to use
101+
87102
### PlantResponse
88103

89104
Response object returned from plant-related API calls.
@@ -92,3 +107,12 @@ Response object returned from plant-related API calls.
92107
- `plants` (Array): List of plant objects
93108
- `total` (number): Total count of plants
94109
- `hasMore` (boolean): Whether more results are available
110+
111+
## Get methods
112+
113+
Common retrieval methods for accessing plant store resources.
114+
115+
| Method | Description | Parameters | Returns |
116+
|--------|-------------|------------|---------|
117+
| `getPlant` | Retrieves a single plant by its ID | `plant_id` (string, required): The unique identifier of the plant | Plant object |
118+
| `getGarden` | Retrieves a single garden by its ID | `garden_id` (string, required): The unique identifier of the garden | Garden object |

0 commit comments

Comments
 (0)