Include lang="xxxx" in Prism component example (#1264)

This commit is contained in:
Sarah Rainsberger 2021-08-29 13:39:39 -03:00 committed by GitHub
parent 9823f16f51
commit 3d73d7fbf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,10 +26,12 @@ See our [Markdown Guide](/guides/markdown-content) for more info.
---
import { Prism } from 'astro/components';
---
<Prism code={`const foo = 'bar';`} />
<Prism lang="js" code={`const foo = 'bar';`} />
```
This component provides syntax highlighting for code blocks. Since this never changes in the client it makes sense to use an Astro component (it's equally reasonable to use a framework component for this kind of thing; Astro is server-only by default for all frameworks!).
This component provides language-specific syntax highlighting for code blocks. Since this never changes in the client it makes sense to use an Astro component (it's equally reasonable to use a framework component for this kind of thing; Astro is server-only by default for all frameworks!).
See the [list of languages supported by Prism](https://prismjs.com/#supported-languages) where you can find a language's corresponding alias. And, you can also display your Astro code blocks with lang="astro"!
## `<Debug />`