function useShikiji(content: string, language: Language) {
const [colored, setColored] = useState('')
useEffect(() => {
const func = async () => {
const html = await codeToHtml(content, {
lang: language,
theme: 'github-light',
transforms: {
pre(node) {
node.properties.class = preClass
},
code(node) {
node.properties.class = `${styles['code']} language-${language}`
},
line(node, _line) {
node.properties.class = `${styles['line']}`
},
},
})
setColored(html)
}
func()
}, [content, language])
return colored
}