Skip to content

Allow the <Feature> component to be respected around <CodeBlock>s in a <CodeBlocks> #6939

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

Open
mmrj opened this issue May 2, 2025 · 0 comments

Comments

@mmrj
Copy link

mmrj commented May 2, 2025

Which Fern component?

Fern CLI

How important is this?

P1 - High (Strongly needed)

What's the feature?

We would very much like to be able to use the following:


<CodeBlocks>
  <Feature flag="flag-key" fallback={false} match={true}>
    <CodeBlock title="flagged stuff">

    flagged code sample

    </CodeBlock>
  </Feature>
  <CodeBlock title="unflagged stuff">

  code sample

  </CodeBlock>
</CodeBlocks>

Currently, the "flagged stuff" code block appears no matter what the value of the "flag-key" is. We would like the "flagged stuff" code block to only appear if the "flag-key" value matches the "match" value.

Our use case is different versions of the samples that we're showing in the code blocks.

Any alternatives?

While there is technically a workaround (move the <Feature> to wrap the entire <CodeBlocks>), this creates a combinatorial explosion of content as soon as we want to flag more than one code block using different flags.

Are you interested in contributing this feature?

No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant