Library docs generator Beta
Library docs generator Beta
The library docs generator parses your Python or C++ library source code and generates MDX documentation pages for modules, classes, functions, methods, and parameters. Generated pages are added to your Fern Docs site with hierarchical navigation.
Cross-links are automatic. When a fully qualified identifier appears in a code block — for example, in a class signature or type annotation — the generator links it to the page documenting that symbol, so readers can jump straight to the definition.
Configuration
Define your libraries in docs.yml
Add a libraries entry to your docs.yml file. Each library needs an input source, an output.path (where generated MDX files are written), and a lang (python or cpp).
The input source can be a git URL, parsed remotely on Fern’s servers, or a local path, parsed on your machine with the --local flag. Local parsing is useful for iterating on documentation without pushing to a remote repository, and doesn’t require you to be logged in to Fern.
git input (remote)
path input (local)
You can define multiple libraries in the same file.
Generate the library docs
Run the fern docs md generate command to generate MDX files from your library source code:
git input (remote)
path input (local)
The command sends the repository URL to Fern’s servers for parsing.
If you have multiple libraries configured, fern docs md generate processes all libraries in parallel. Use --library plant-sdk to generate docs for a specific library only.
The generated docs form a navigation section with pages for each module, class, function, and type in your library.
Multiple libraries example
You can define and reference multiple libraries in the same docs.yml:
Customize generated docs (optional)
You can reorganize the output directory to restructure the sidebar navigation. Move, rename, or nest files and subfolders, and Fern picks up the new layout on the next fern docs dev or publish.
For example, splitting ./static/plant-sdk-docs into getting-started/ and reference/ subfolders produces two sidebar sections:
You can also edit page content by modifying the MDX files directly — generated pages are standard MDX, so you can add prose, examples, callouts, or any component. Re-running fern docs md generate overwrites everything in output.path, so commit your customizations first, and keep hand-edited pages outside the output directory if you plan to regenerate.
Configuration reference
GitHub URL of the repository containing the library source code. Parsed remotely on Fern’s servers. Mutually exclusive with input.path.
Path within the repository to the library source. Only valid with input.git. Useful for monorepos.
Local filesystem path to the library source, relative to the fern/ directory. Requires --local flag. Mutually exclusive with input.git.
Directory where the generated MDX files are written, relative to the fern/ directory.
The language of the library. Supported values: python, cpp.
Path to a custom Doxyfile. C++ only. For local generation, the Doxyfile’s input paths are resolved relative to the input.path directory.