diff --git a/fern/assets/styles.css b/fern/assets/styles.css index 922a2b4a0..1e9cf7f3c 100644 --- a/fern/assets/styles.css +++ b/fern/assets/styles.css @@ -1082,7 +1082,8 @@ h1, h2, h3 { /*** END -- LANDING PAGE STYLING ***/ /* HACK: add a slash to markdown snippet documentation (otherwise it gets parsed by CLI) */ -.modify-snippet tbody tr:last-of-type td:last-of-type .line span:last-of-type:before { +.modify-snippet tbody tr:nth-child(1) td:last-of-type .line span:last-of-type:before, +.modify-snippet tbody tr:nth-child(5) td:last-of-type .line span:last-of-type:before { content: "/"; display: inline-block; } diff --git a/fern/products/docs/pages/changelog/2025-11-08.mdx b/fern/products/docs/pages/changelog/2025-11-08.mdx index d96ee41de..7480651b8 100644 --- a/fern/products/docs/pages/changelog/2025-11-08.mdx +++ b/fern/products/docs/pages/changelog/2025-11-08.mdx @@ -1,3 +1,25 @@ +## Parameterized markdown snippets + +Reusable Markdown snippets support arbitrary parameters that can be used as variables in the snippet. This enables flexible, reusable content templates. + +Create a snippet with parameter placeholders using curly braces: + +```mdx fern/snippets/watering-schedule.mdx +Remember to water your {plant} every {interval} days. +``` + +Pass parameters when including the snippet: + +```mdx page.mdx + +``` + +This renders as: + + + +Learn more about [reusable Markdown snippets](/learn/docs/writing-content/reusable-snippet). + ## New Copy component for inline copyable text The `` component makes text copyable with a single click. Use it inline to allow readers to quickly copy version numbers, commands, API keys, or other text snippets without selecting and copying manually. diff --git a/fern/products/docs/pages/component-library/custom-components/reusable-markdown.mdx b/fern/products/docs/pages/component-library/custom-components/reusable-markdown.mdx index 12199a971..570b1bdcb 100644 --- a/fern/products/docs/pages/component-library/custom-components/reusable-markdown.mdx +++ b/fern/products/docs/pages/component-library/custom-components/reusable-markdown.mdx @@ -27,28 +27,38 @@ fern In each snippet file, define the content you want to reuse. ```mdx title="snippets/peace-lily.mdx" - Remember to water your plant at least twice a week. +Peace lilies are easy to grow and relatively trouble-free. ``` + +Optionally, you can use parameters in your snippet: +```mdx title="snippets/watering-schedule.mdx" +Remember to water your {plant} every {interval} days. +``` + -To use a snippet in your documentation, reference it by its file path (including the `.mdx` extension). For example, to include the `peace-lily` snippet from the folder structure above: +To use a snippet in your documentation, reference it by its file path (including the `.mdx` extension). If you used one or more parameters in your snippet, pass them in the snippet reference:
```jsx - Peace lilies are easy to grow and relatively trouble-free. - + + They symbolize peace and prosperity. + + ```
- Peace lilies are easy to grow and relatively trouble-free. - + + They symbolize peace and prosperity. + +
@@ -62,4 +72,5 @@ To use a snippet in your documentation, reference it by its file path (including | `fern/docs/guides/snippets/peace-lily.mdx` | `src="/docs/guides/snippets/peace-lily.mdx"` |
- \ No newline at end of file + + diff --git a/fern/snippets/peace-lily.mdx b/fern/snippets/peace-lily.mdx index bbd271447..1e9e6db2a 100644 --- a/fern/snippets/peace-lily.mdx +++ b/fern/snippets/peace-lily.mdx @@ -1 +1 @@ - Remember to water your plant at least twice a week. \ No newline at end of file +Peace lilies are easy to grow and relatively trouble-free. \ No newline at end of file diff --git a/fern/snippets/watering-schedule.mdx b/fern/snippets/watering-schedule.mdx new file mode 100644 index 000000000..2716162c2 --- /dev/null +++ b/fern/snippets/watering-schedule.mdx @@ -0,0 +1 @@ +Remember to water your {plant} every {interval} days. \ No newline at end of file