Skip to content

@shiki/rehype: templating for dynamic parts of code? #858

@karlhorky

Description

@karlhorky

Clear and concise description of the problem

Similar to https://github.com/orgs/mdx-js/discussions/2288 , I'm looking for a way to dynamically interpolate dynamic values in code blocks

Suggested solution

Eg one example could look like this:

```bash
pnpm add @upleveled/ley@{props.versions.ley} tsx@{props.versions.tsx}
```

Where the final version would look like this:

These would be interpolated ideally based on props passed to the MDX compiled component.

Alternative

Use a React component to apply Shiki highlighting in a different way, instead of @rehype/shiki

Additional context

--

Validations

Contributes

  • If this feature request is accepted, I am willing to submit a PR to fix this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions