Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions fern/products/docs/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ navigation:
- page: Generate GraphQL Reference
path: ./pages/api-references/generate-graphql-ref.mdx
slug: generate-graphql-ref
- section: Library references
availability: beta
collapsed: true
contents:
- page: Generate library reference
path: ./pages/api-references/generate-library-ref.mdx
slug: generate-library-ref
- section: SEO & GEO
slug: seo
collapsed: true
Expand Down
108 changes: 108 additions & 0 deletions fern/products/docs/pages/api-references/generate-library-ref.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
title: Generate library reference
description: Use Fern Docs to generate library reference documentation from your library's source code.
availability: beta
---

Fern generates library reference documentation directly from your library's source code. Point Fern at a GitHub repository and it produces a browsable reference for your docs site that includes:

- **MDX pages** for each module, with summary tables and detailed definitions for classes, functions, and attributes
- **`_navigation.yml`** describing the module hierarchy for sidebar navigation

<Note>
Supported languages: Python (beta) and C++ (in development).
</Note>

## Configuration

<Steps>
<Step title="Add a libraries section to docs.yml">

Define each library with an `input` source location, `output` directory for the generated pages, and the source `lang`.

```yaml docs.yml
libraries:
my-python-sdk:
input:
git: https://github.com/your-org/your-python-sdk
subpath: src/my_sdk # optional path within the repo
output:
path: ./generated/my-python-sdk
lang: python
```

</Step>
<Step title="Generate the library docs">

Run the CLI command to parse your library and generate MDX files:

```bash
fern docs md generate
```

To generate docs for a single library, pass the `--library` flag:

```bash
fern docs md generate --library my-python-sdk
```

</Step>
<Step title="Add the library to your navigation">

Reference the library in your `docs.yml` navigation using the `library` key. The value must match a key in your `libraries` section.

```yaml docs.yml {6}
navigation:
- section: Getting started
contents:
- page: Overview
path: ./pages/overview.mdx
- library: my-python-sdk
title: Python SDK Reference
slug: python-sdk
```

Fern injects the generated navigation at this point in the sidebar, with the root module page as the section overview.

<Tip>
During local development with `fern docs dev`, the generated pages are resolved as first-class navigation sections with cross-reference links between types.
</Tip>

</Step>
</Steps>

## Configuration reference

### Library definition

Each entry under `libraries` in `docs.yml` accepts the following fields:

<ParamField path="input.git" type="string" required>
GitHub URL to the repository containing the library source code.
</ParamField>

<ParamField path="input.subpath" type="string">
Path within the repository to the library source. Use this when the library code is in a subdirectory.
</ParamField>

<ParamField path="output.path" type="string" required>
Directory where Fern writes the generated MDX files and `_navigation.yml`.
</ParamField>

<ParamField path="lang" type="string" required>
Programming language of the library source code. Supported values: `python`.
</ParamField>

### Navigation item

<ParamField path="library" type="string" required>
The name of the library to reference. Must match a key in the `libraries` section.
</ParamField>

<ParamField path="title" type="string">
Override the display title for this library reference in the sidebar.
</ParamField>

<ParamField path="slug" type="string">
Override the URL slug for this library reference.
</ParamField>
5 changes: 5 additions & 0 deletions fern/products/docs/pages/changelog/2026-02-12.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Generate library reference (beta)

Generate browsable reference documentation directly from your library's source code. Define a `libraries` section in `docs.yml`, run `fern docs md generate`, and add a `library` navigation item to include the generated pages in your sidebar. Python is supported, with C++ in active development.

Learn more about [generating library references](/learn/docs/library-references/generate-library-ref).