Reusable snippets
Keep your documentation DRY (Don’t Repeat Yourself) by defining a reusable Markdown snippet once, and then referencing it in multiple places. This way, you only need to update the snippet in one place to keep all references in sync.
Reusable snippets work well for constants (API limits, subscription prices, version numbers), repeated warnings or notes, and standardized formatting blocks.
Create a reusable snippet
To use reusable snippets, start by creating a new folder in your fern
project called snippets
. Inside the snippets
folder, create a new Markdown file for each snippet you want to define.
For example:
In each snippet file, define the content you want to reuse. For example, peace-lily.mdx
might contain:
Use a reusable snippet
To use a snippet in your documentation, reference it by its file path (including the .mdx
extension) in your content. For example, to include the peace-lily
snippet in your content, use: