Skip to content

ShredderMing/preact-prism

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

Preact syntax highlighting component using prism

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published