use Prism syntax highlighter in preact projects.
npm install preact-prism
or
yarn add preact-prism
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);