diff --git a/fern/products/docs/docs.yml b/fern/products/docs/docs.yml index c2c8e18a6..05c46df62 100644 --- a/fern/products/docs/docs.yml +++ b/fern/products/docs/docs.yml @@ -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 diff --git a/fern/products/docs/pages/api-references/generate-library-ref.mdx b/fern/products/docs/pages/api-references/generate-library-ref.mdx new file mode 100644 index 000000000..134e5b14b --- /dev/null +++ b/fern/products/docs/pages/api-references/generate-library-ref.mdx @@ -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 + + + Supported languages: Python (beta) and C++ (in development). + + +## Configuration + + + + +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 +``` + + + + +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 +``` + + + + +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. + + + During local development with `fern docs dev`, the generated pages are resolved as first-class navigation sections with cross-reference links between types. + + + + + +## Configuration reference + +### Library definition + +Each entry under `libraries` in `docs.yml` accepts the following fields: + + + GitHub URL to the repository containing the library source code. + + + + Path within the repository to the library source. Use this when the library code is in a subdirectory. + + + + Directory where Fern writes the generated MDX files and `_navigation.yml`. + + + + Programming language of the library source code. Supported values: `python`. + + +### Navigation item + + + The name of the library to reference. Must match a key in the `libraries` section. + + + + Override the display title for this library reference in the sidebar. + + + + Override the URL slug for this library reference. + diff --git a/fern/products/docs/pages/changelog/2026-02-12.mdx b/fern/products/docs/pages/changelog/2026-02-12.mdx new file mode 100644 index 000000000..c8a796935 --- /dev/null +++ b/fern/products/docs/pages/changelog/2026-02-12.mdx @@ -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).