Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snippet templates example #57

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
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
7 changes: 7 additions & 0 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ navigation:
- page: SDKs
path: docs/pages/sdks.mdx
slug: sdks
- page: Snippet Templates
path: docs/pages/snippet-templates.mdx
hidden: true
- api: API Reference

navbar-links:
Expand All @@ -45,3 +48,7 @@ logo:
href: https://buildwithfern.com/?utm_campaign=demo&utm_medium=plantstore&utm_source=logo

favicon: docs/assets/favicon.svg

experimental:
mdx-components:
- ./docs/snippets
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is required at the moment for ESM imports to discover these files

15 changes: 15 additions & 0 deletions fern/docs/pages/snippet-templates.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Template from "../snippets/code-template.mdx";

Below are 2 code snippets that are templated using the `code-template` mdx-based component.

<Template title="Example 1" components={props.components}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

at the moment there's a bug where components={props.components} need to be passed in explicitly. We'll need to fix this on our side so it's handled automatically.

```python
print("Example 1")
```
</Template>

<Template title="Example 2" components={props.components}>
```python
print("Example 2")
```
</Template>
5 changes: 5 additions & 0 deletions fern/docs/snippets/code-template.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This is a templated code snippet for {props.title}.

<CodeBlock title={props.title}>
{props.children}
</CodeBlock>
2 changes: 1 addition & 1 deletion fern/fern.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"organization": "plantstore",
"version": "0.37.6"
"version": "0.45.0"
}
2 changes: 2 additions & 0 deletions fern/generators.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
api:
path: openapi/openapi.yaml
Loading