Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shredderming/preact-prism
Preact syntax highlighting component using prism
https://github.com/shredderming/preact-prism
highlight preact preact-components prism
Last synced: 4 days ago
JSON representation
Preact syntax highlighting component using prism
- Host: GitHub
- URL: https://github.com/shredderming/preact-prism
- Owner: ShredderMing
- Created: 2017-12-30T14:14:07.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-21T08:48:57.000Z (almost 7 years ago)
- Last Synced: 2024-10-30T15:56:10.121Z (15 days ago)
- Topics: highlight, preact, preact-components, prism
- Language: JavaScript
- Size: 14.6 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# preact-prism [![npm version](https://img.shields.io/npm/v/preact-prism.svg?style=flat)](https://www.npmjs.com/package/preact-prism)
use [Prism](http://prismjs.com) syntax highlighter in preact projects.
## Install``` sh
npm install preact-prism
```
or``` sh
yarn add preact-prism
```
## Example``` js
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(
, document.body);
// or render({code}
, document.body);
```