Variable replacement in Expressive Code blocks in MDX #2863
Closed
oprypkhantc
started this conversation in
Feature Requests
Replies: 1 comment 1 reply
-
Hey @oprypkhantc! I think this may just be a limitation of MDX? AFAIK it doesn’t support variables in code blocks so it is not a restriction specific to Expressive Code (or Astro or Starlight)? |
Beta Was this translation helpful? Give feedback.
1 reply
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
What version of
starlight
are you using?0.29.2
What is your idea?
Hey.
Currently, variables are not being replaced in Expressive Code's code blocks in MDX:
The
{import.meta.env.API_URL}
stays as is, even though it works in other Markdown elements. There is a workaround, but it involves a lot of extra movements:<Code>
component<Code>
componentec.config.mjs
This both looks and feels wrong :)
Why is this feature necessary?
To greatly improve developer experience when working with code blocks that contain env variables.
One thing I'm not sure is whether this belongs to this repository or
astro-expressive-code
. I imagine this should be implemented as a plugin forastro-expressive-code
? It also seems that blindly replacing everything in{}
brackets would break a lot of things, so I guess this should either be an opt-in plugin, or be explicit:Do you have examples of this feature in other projects?
No response
Participation
Beta Was this translation helpful? Give feedback.
All reactions