diff options
-rw-r--r-- | .changeset/great-poets-pull.md | 5 | ||||
-rw-r--r-- | packages/astro/components/Prism.astro | 2 | ||||
-rw-r--r-- | packages/astro/test/astro-markdown.test.js | 1 |
3 files changed, 7 insertions, 1 deletions
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 `<pre>` 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) { --- -<pre class={className}><code class={classLanguage}>{html}</code></pre> +<pre class={[className, classLanguage].join(' ')}><code class={classLanguage}>{html}</code></pre> 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'); }); |