preact-prism

0.1.2 • Public • Published

preact-prism npm version

use Prism syntax highlighter in preact projects.

Install

npm install preact-prism

or

yarn add preact-prism

Example

import { h, render } from 'preact';
import Code from 'preact-prism';
import 'prismjs/themes/prism-solarizedlight.css'; /* import prism themes */

const code = `
.container {
  position: relative;
  height: 100%;
}
.inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%)
}
`;

render(<Code code={code} language="css" />, document.body);
// or render(<Code language="css">{code}</Code>, document.body);

Package Sidebar

Install

npm i preact-prism

Weekly Downloads

4

Version

0.1.2

License

MIT

Last publish

Collaborators

  • shredderming