including the language- class on Prism's <pre> element (#1180)

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

* adding changeset

Co-authored-by: Tony Sullivan <tony.f.sullivan@gmail.com>
This commit is contained in:
Tony Sullivan 2021-08-20 18:01:42 +00:00 committed by GitHub
parent aaef6aefef
commit 1e0e2f41cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Including Prism's `language-` class on code block `<pre>` tags

View file

@ -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>

View file

@ -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');
});