Skip to content

Commit ab9a6ad

Browse files
(docs) Document limitations in preview mode and dynamic snippets (#852)
Co-authored-by: promptless[bot] <179508745+promptless[bot]@users.noreply.github.com> Co-authored-by: Devin Logan <[email protected]>
1 parent fd4ca7f commit ab9a6ad

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

fern/products/docs/pages/api-references/sdk-snippets.mdx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ title: Display SDK snippets
33
description: Enable SDK code examples in TypeScript, Python, Go, and more from the request and response examples documented in your API definition. Once enabled, Fern Docs will automatically populate the snippets within your API Reference.
44
---
55

6-
When you use Fern's SDK Generator, you can automatically display SDK code snippets in your API Reference. These snippets appear in a language selector dropdown, with cURL as the default option.
6+
When you use Fern's SDK Generator, you can automatically display SDK code snippets in your API Reference. These snippets are generated from your API definition examples and appear in a language selector dropdown, with cURL as the default option.
77

8-
<Note> Fern supports SDK snippets for TypeScript, Python, Ruby, Go, and .NET/C#. </Note>
8+
<Note title="Dynamic snippets">
9+
By default, SDK snippets are static code examples. Alternatively, you can use dynamic SDK snippets that allow users to modify parameters and see code examples update in real time.
10+
11+
To use dynamic snippets, [enable them in your `docs.yml`](/docs/configuration/what-is-docs-yml#dynamic-snippets-configuration) and then complete the setup instructions on this page.
12+
</Note>
913

1014
<Frame>
1115
![SDK code snippet selector](https://fern-image-hosting.s3.amazonaws.com/sdk-code-snippets.png)
@@ -27,6 +31,8 @@ Configure package names in your `generators.yml` file:
2731
* For **Python, TypeScript, Ruby, and .NET/C#**, add `package-name: your-package-name` to the `output` section.
2832
* For **Go**, add `repository: your-organization/your-repository` to the `github` section.
2933

34+
<Note>Fern supports SDK snippets for TypeScript, Python, Ruby, Go, and .NET/C#. [Contact us](https://buildwithfern.com/contact) if you need support for more languages. </Note>
35+
3036
<CodeBlock title="generators.yml">
3137
```yaml {9, 16, 22, 26}
3238
groups:
@@ -71,6 +77,7 @@ groups:
7177
</Callout>
7278

7379
### Add the package name to your docs configuration
80+
7481
Add the package name for the corresponding SDK to your `docs.yml` file:
7582
* **For Python, TypeScript, Ruby, and .NET/C#**, `your-package-name` must match the `your-package-name` that you configured in your `generators.yml` file.
7683
* **For Go**, use the exact URL where the SDK repository is located, including the `https://github.com/`.
@@ -110,7 +117,7 @@ navigation:
110117
111118
### Trigger generation
112119
113-
As the final step, trigger your docs generation by running `fern generate --docs` locally or in CI/CD (i.e., GitHub Actions). The SDK snippets will now appear via a drop-down!
120+
As the final step, trigger your docs generation by running `fern generate --docs` locally or in CI/CD (i.e., GitHub Actions). The SDK snippets will now appear via a dropdown!
114121

115122
### Set default snippet language
116123

fern/products/docs/pages/customization/what-is-docs-yml.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,3 +558,16 @@ analytics:
558558
<ParamField path="analytics.posthog.api-key" type="string" required={false}>
559559
Your PostHog project API key. Defaults to the api-host of "https://us.i.posthog.com".
560560
</ParamField>
561+
562+
## Dynamic snippets configuration
563+
564+
By default, SDK snippets are static code examples that are displayed in your API Reference. Alternatively, you can use dynamic SDK snippets that allow users to modify parameters and see code examples update in real time.
565+
566+
Enable dynamic snippets in `docs.yml`, then configure them by [following the SDK snippets setup instructions](/docs/api-references/sdk-snippets).
567+
568+
```yaml docs.yml
569+
experimental:
570+
dynamic-snippets: true
571+
```
572+
573+

fern/products/docs/pages/getting-started/preview-changes-locally.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fern docs dev
3737
A local preview of your documentation will be available at `http://localhost:3000`. The functionality is available offline if you have run local development mode online at least once.
3838

3939
<Note>
40-
Some features (e.g. search) are disabled in the local development environment, including:
40+
Some features are disabled in the local development environment, including:
4141
- Search
4242
- SEO (favicon, auto-generated meta tags, etc.)
4343
- Authentication

0 commit comments

Comments
 (0)