From b9e455b4b2a86e18ae4f693e6fe9ad233762c67f Mon Sep 17 00:00:00 2001 From: Roman Kholiavko Date: Tue, 17 Feb 2026 10:18:43 +0200 Subject: [PATCH 1/2] chore: remove unnecessary `--save-dev` in installation commands (#15546) --- README.md | 2 +- packages/astro/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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. From 5b8f5737feb1a051b7cbd5d543dd230492e5211f Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Tue, 17 Feb 2026 09:43:20 +0100 Subject: [PATCH 2/2] Embedded langs in (#15298) (#15548) * option for adding additional langs * tests * changeset * cleanup test * cleanup test * cleanup * clarify changeset * Update .changeset/tangy-tables-jog.md * add more details to changeset * add more details to changeset * Update .changeset/tangy-tables-jog.md * Update .changeset/tangy-tables-jog.md * minor not patch * Apply suggestions from code review --------- Co-authored-by: Justin Francos Co-authored-by: Emanuele Stoppa Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> --- .changeset/tangy-tables-jog.md | 25 +++++++++++++++++++ packages/astro/components/Code.astro | 10 ++++++++ .../astro/test/astro-component-code.test.js | 6 +++++ .../src/pages/langs.astro | 12 +++++++++ 4 files changed, 53 insertions(+) create mode 100644 .changeset/tangy-tables-jog.md create mode 100644 packages/astro/test/fixtures/astro-component-code/src/pages/langs.astro 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/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 = ` + +` +--- +