0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/prism-astro/Prism.astro
Matthew Phillips 397b7145cc
Add prism and skeleton www page (#49)
* Add prism and skeleton www page

This adds a Prism plugin, a Prism component, and the skeleton of our www site (just for testing the Prism component at the moment).

* Remove debugging
2021-04-01 15:16:29 -04:00

16 lines
No EOL
323 B
Text

---
import Prism from 'prismjs';
import { addAstro } from './index.mjs';
addAstro(Prism);
export let lang;
export let code;
const grammar = Prism.languages[lang];
let html = Prism.highlight(code, grammar, lang);
let className = `language-${lang}`;
---
<pre class={className}><code class={className}>{html}</code></pre>