Reusable Snippets
Keep your documentation DRY (Don’t Repeat Yourself) by defining a reusable 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.
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 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:
snippets/peace-lily.mdx
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:
pages/my-tutorial.mdx