use-shiki
v1.0.0
Published
React hook for using Shiki syntax highlighter
Downloads
7
Readme
use-shiki
React hook for using Shiki syntax highlighter
Usage
import useShiki, { setCDN } from 'use-shiki'
setCDN('https://unpkg.com/shiki/')
function App() {
const highlighter = useShiki({ theme: 'dracula', langs: ['jsx'] })
return (
<code
dangerouslySetInnerHTML={{
__html: highlighter?.codeToHtml(
'const [count, setCount] = useState(0)',
{
lang: 'jsx',
},
),
}}
/>
)
}
export default App
Contributing
Issues and pull requests are welcome.