Skip to content

Allow conditional text in reusable snippets #11369

@imnotashrimp

Description

@imnotashrimp

Which Fern component?

Fern Docs

How important is this?

P1 - High (Strongly needed)

What's the feature?

Fern's snippets allow for variables only, so something like this isn't supported:

<Markdown src="/snippets/_bash-deploy.mdx" sourceFlow={true} />
4. Choose a {sourceFlow && 'management group or'} subscription to connect. {sourceFlow && "If you choose a management group, you'll connect all the subscriptions it contains, including subscriptions added in the future."}

I would like to be able to, based on a Markdown prop, conditionalize multiple places in the snippet. For example, you can see in the code block above that, just based on the presence of sourceFlow, multiple portions of the step are modified.

Any alternatives?

I considered writing a custom component, but I'd have to have a separate MDX dependency, and I couldn't get it to work with Fern's built-in components (eg, <Note>)

Are you interested in contributing this feature?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions