Skip to content

Conversation

@jfrancos
Copy link

@jfrancos jfrancos commented Jan 25, 2026

Changes

This PR addresses #15271 adding an optional embeddedLangs prop to <Code /> :

  • Previously, <Code /> creates a shiki highlighter with langs: [lang].
  • This usually works great. Embedded langs are already included in canonical situations like ts-in-svelte without a need for additional langs.
  • But in some less canonical cases e.g. tsx-in-vue, more control is needed over the langs param for shiki to correctly highlight
  • Now shiki highlighter is created with langs: [lang, ...embeddedLangs]

Testing

  • Create fixture using TSX in Vue
  • Without langs support, setting lang to "vue" results in the main line of TSX being one long <span />.
  • With langs support, each TSX token is its own <span />
  • Test for a <span /> containing the lone string "const"

Docs

Docs will need an update here (can I do this for en? Would I submit an issue there first or just a PR?)
/cc @withastro/maintainers-docs

@changeset-bot
Copy link

changeset-bot bot commented Jan 25, 2026

🦋 Changeset detected

Latest commit: c05d9c9

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jan 25, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 25, 2026

⚠️ Package Trust Level Decreased

Caution

Decreased trust levels may indicate a higher risk of supply chain attacks. Please review these changes carefully.

📦 Package 🔒 Before 🔓 After
eslint-plugin-regexp trusted-with-provenance none
@cloudflare/kv-asset-handler trusted-with-provenance none
@cloudflare/unenv-preset trusted-with-provenance none
workerd trusted-with-provenance none
@sveltejs/vite-plugin-svelte-inspector trusted-with-provenance provenance
@sveltejs/vite-plugin-svelte trusted-with-provenance provenance
jsdoc-type-pratt-parser trusted-with-provenance none
miniflare trusted-with-provenance none
youch provenance none
@cloudflare/workerd-darwin-64 trusted-with-provenance none
@cloudflare/workerd-darwin-arm64 trusted-with-provenance none
@cloudflare/workerd-linux-64 trusted-with-provenance none
@cloudflare/workerd-linux-arm64 trusted-with-provenance none
@cloudflare/workerd-windows-64 trusted-with-provenance none
wrangler trusted-with-provenance none
@jfrancos jfrancos changed the title Embedded langs Jan 25, 2026
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Thank you @jfrancos

Contributors are responsible of the docs, so yes you send a PR to the docs repository. Doing the english translation is more than enough

@ematipico ematipico self-assigned this Jan 27, 2026
@jfrancos jfrancos force-pushed the embedded-langs branch 2 times, most recently from 9a4a5ea to f284901 Compare January 27, 2026 15:34
@jfrancos
Copy link
Author

Thanks @ematipico. I've added more detail to the changeset.

@jfrancos
Copy link
Author

jfrancos commented Jan 27, 2026

@astrojs/cloudflare:test: code: 'ECONNREFUSED',
@astrojs/cloudflare:test: MiniflareCoreError [ERR_DISPOSED]: Cannot use disposed instance

There are some CI issues, seemingly unrelated to this PR.
CI passes after rebase from next

@matthewp matthewp deleted the branch withastro:next January 30, 2026 17:31
@matthewp matthewp closed this Jan 30, 2026
@matthewp
Copy link
Contributor

Sorry about the close.

@matthewp matthewp reopened this Jan 30, 2026
@jfrancos
Copy link
Author

Sorry about the close.

No worries @matthewp

@florian-lefebvre thanks for the corrections

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

Labels

pkg: astro Related to the core `astro` package (scope)

4 participants