From 1e0e2f41cd5fa146917afada10cc894e80fd3787 Mon Sep 17 00:00:00 2001 From: Tony Sullivan Date: Fri, 20 Aug 2021 18:01:42 +0000 Subject: [PATCH] including the `language-` class on Prism's `
` element
 (#1180)

* including the `language-` class on Prism's `
` element

* adding changeset

Co-authored-by: Tony Sullivan 
---
 .changeset/great-poets-pull.md             | 5 +++++
 packages/astro/components/Prism.astro      | 2 +-
 packages/astro/test/astro-markdown.test.js | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 .changeset/great-poets-pull.md

diff --git a/.changeset/great-poets-pull.md b/.changeset/great-poets-pull.md
new file mode 100644
index 000000000..5915b676a
--- /dev/null
+++ b/.changeset/great-poets-pull.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Including Prism's `language-` class on code block `
` tags
diff --git a/packages/astro/components/Prism.astro b/packages/astro/components/Prism.astro
index b96f4c358..6aaffbe74 100644
--- a/packages/astro/components/Prism.astro
+++ b/packages/astro/components/Prism.astro
@@ -42,4 +42,4 @@ if (grammar) {
 
 ---
 
-
{html}
+
{html}
diff --git a/packages/astro/test/astro-markdown.test.js b/packages/astro/test/astro-markdown.test.js index baf39fb3e..b0a1dba4d 100644 --- a/packages/astro/test/astro-markdown.test.js +++ b/packages/astro/test/astro-markdown.test.js @@ -41,6 +41,7 @@ Markdown('Scoped styles should not break syntax highlight', async ({ runtime }) const $ = doc(result.contents); assert.ok($('pre').is('[class]'), 'Pre tag has scopedStyle class passed down'); + assert.ok($('pre').hasClass('language-js'), 'Pre tag has correct language'); assert.ok($('code').hasClass('language-js'), 'Code tag has correct language'); assert.ok($('code span').length > 0, 'There are child spans in code blocks'); });