Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
23 changes: 23 additions & 0 deletions fern/products/docs/pages/changelog/2025-11-08.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Parameterized markdown snippets

Reusable markdown snippets can now accept arbitrary parameters that can be used as variables in the snippet. This enables flexible, reusable content templates.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [vale] reported by reviewdog 🐶
[FernStyles.Current] Avoid time-relative terms like 'now' that become outdated


Create a snippet with parameter placeholders using curly braces:

```mdx fern/snippets/feature.mdx
This feature is only available on the {plan} plan.
```

Pass parameters when including the snippet:

```mdx page.mdx
<Markdown src="/snippets/feature.mdx" plan="pro" />
```

This renders as:

```
This feature is only available on the pro plan.
```

Learn more about [reusable markdown snippets](/learn/docs/content/markdown#reusable-markdown-snippets).
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,70 @@ The value for `page` is used as the content of the top `<h1>` element of this pa

Fern has a built-in component library you can use in Markdown. [Explore the components.](/learn/docs/content/components/overview)

## Reusable markdown snippets

You can create reusable markdown snippets and include them in multiple pages using the `<Markdown>` component. This is useful for content that appears in multiple places, such as warnings, common instructions, or version numbers.

### Basic usage

Create a snippet file in your `fern/snippets/` folder:

<CodeBlock title='fern/snippets/common-warning.mdx'>
```mdx
<Warning>
This feature is in beta and may change in future releases.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [vale] reported by reviewdog 🐶
[FernStyles.Current] Avoid time-relative terms like 'future' that become outdated

</Warning>
```
</CodeBlock>

Then include it in any page using the `<Markdown>` component:

<CodeBlock title='page.mdx'>
```mdx
<Markdown src="/snippets/common-warning.mdx" />
```
</CodeBlock>

### Parameterized snippets

Snippets can accept arbitrary parameters that can be used as variables within the snippet content. This allows you to create flexible, reusable content templates.

Create a snippet with parameter placeholders using curly braces:

<CodeBlock title='fern/snippets/feature.mdx'>
```mdx
This feature is only available on the {plan} plan.
```
</CodeBlock>

Pass parameters when including the snippet:

<CodeBlock title='page.mdx'>
```mdx
<Markdown src="/snippets/feature.mdx" plan="pro" />
```
</CodeBlock>

This renders as:

```
This feature is only available on the pro plan.
```

You can use multiple parameters in a single snippet:

<CodeBlock title='fern/snippets/sdk-install.mdx'>
```mdx
Install the {language} SDK version {version} using {packageManager}.
```
</CodeBlock>

<CodeBlock title='page.mdx'>
```mdx
<Markdown src="/snippets/sdk-install.mdx" language="TypeScript" version="3.28.1" packageManager="npm" />
```
</CodeBlock>

## Links in Markdown

### Link target
Expand Down