diff --git a/.changeset/tangy-tables-jog.md b/.changeset/tangy-tables-jog.md
new file mode 100644
index 000000000000..e7284c44b8f1
--- /dev/null
+++ b/.changeset/tangy-tables-jog.md
@@ -0,0 +1,25 @@
+---
+'astro': minor
+---
+
+Adds a new optional `embeddedLangs` prop to the `` component to support languages beyond the primary `lang`
+
+This allows, for example, highlighting `.vue` files with a `
+
+
+
+`
+---
+
+```
+
+See the [`` component documentation](https://v6.docs.astro.build/en/guides/syntax-highlighting/#code-) for more details.
diff --git a/README.md b/README.md
index e25734a65304..32003cf0e6f8 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@ npm create astro@latest
You can also install Astro **manually** by running this command instead:
```bash
-npm install --save-dev astro
+npm install astro
```
Looking for help? Start with our [Getting Started](https://docs.astro.build/en/getting-started/) guide.
diff --git a/packages/astro/README.md b/packages/astro/README.md
index 3d429d03eb91..600400c64573 100644
--- a/packages/astro/README.md
+++ b/packages/astro/README.md
@@ -15,7 +15,7 @@
npm create astro@latest
# Manual:
-npm install --save-dev astro
+npm install astro
```
Looking for help? Start with our [Getting Started](https://docs.astro.build/en/getting-started/) guide.
diff --git a/packages/astro/components/Code.astro b/packages/astro/components/Code.astro
index bdc71729af5c..a84083cebe8a 100644
--- a/packages/astro/components/Code.astro
+++ b/packages/astro/components/Code.astro
@@ -16,6 +16,14 @@ interface Props extends Omit, 'lang'> {
* @default "plaintext"
*/
lang?: CodeLanguage;
+ /**
+ * Additional languages to load.
+ * Useful if `code` embeds languages not included by the given `lang`
+ * For example, TSX in Vue
+ *
+ * @default []
+ */
+ embeddedLangs?: CodeLanguage[];
/**
* A metastring to pass to the highlighter.
* Allows passing information to transformers: https://shiki.style/guide/transformers#meta
@@ -72,6 +80,7 @@ interface Props extends Omit, 'lang'> {
const {
code,
lang = 'plaintext',
+ embeddedLangs = [],
meta,
theme = 'github-dark',
themes = {},
@@ -101,6 +110,7 @@ const highlighter = await createShikiHighlighter({
? lang
: 'plaintext'
: (lang as any),
+ ...embeddedLangs,
],
theme,
themes,
diff --git a/packages/astro/test/astro-component-code.test.js b/packages/astro/test/astro-component-code.test.js
index adb77a33aec3..3c7b7738479b 100644
--- a/packages/astro/test/astro-component-code.test.js
+++ b/packages/astro/test/astro-component-code.test.js
@@ -121,4 +121,10 @@ describe('', () => {
assert.match(codeEl.attr('style'), /background-color:/);
assert.equal($('pre').length, 0);
});
+
+ it(' tokenizes TSX', async () => {
+ const html = await fixture.readFile('/langs/index.html');
+ const $ = cheerio.load(html);
+ assert.ok([...$('.line > span')].some((el) => $(el).text().trim() === 'const'));
+ });
});
diff --git a/packages/astro/test/fixtures/astro-component-code/src/pages/langs.astro b/packages/astro/test/fixtures/astro-component-code/src/pages/langs.astro
new file mode 100644
index 000000000000..ccc0adda5349
--- /dev/null
+++ b/packages/astro/test/fixtures/astro-component-code/src/pages/langs.astro
@@ -0,0 +1,12 @@
+---
+import {Code} from 'astro:components';
+
+const code = `
+
+
+
+`
+---
+