You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add documentation for the new deep-linking feature in code blocks that allows defining a links map to make specific text clickable. Includes examples for exact string matching, regex pattern matching, and combining both approaches.
Co-Authored-By: Catherine Deskur <[email protected]>
Copy file name to clipboardExpand all lines: fern/products/docs/pages/component-library/default-components/code-blocks.mdx
+103-2Lines changed: 103 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -303,11 +303,112 @@ To disable scrolling and wrap overflow onto the next line, use the `wordWrap` pr
303
303
</Tabs>
304
304
305
305
306
+
## Deep-linking
307
+
308
+
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.
309
+
310
+
The `links` property accepts a map where keys are matching patterns (exact strings or regex) and values are the URLs to link to.
const client = new PlantClient({ apiKey: "YOUR_API_KEY" });
332
+
const plant = await client.createPlant({
333
+
name: "Monstera",
334
+
species: "Monstera deliciosa"
335
+
});
336
+
```
337
+
````
338
+
339
+
<Note>
340
+
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.
341
+
</Note>
342
+
</Tab>
343
+
</Tabs>
344
+
345
+
### Regex pattern matching
346
+
347
+
You can use regex patterns for more flexible matching. This is useful when you want to link multiple variations or patterns of text.
0 commit comments