jsx-xml
jsx-xml copied to clipboard
Async components support
It would be great to have async components, in case a component is async the render function would return a promise that resolves when all components resolve
import { codeToTokens } from 'shiki'
export async function CodeSnippet({ code, lang, theme }) {
const renderer = getSVGRenderer({
fontFamily: 'monospace',
fontSize: 14,
bg: '#282c34',
})
const { tokens } = await codeToTokens(code, {
lang,
theme,
})
const svg = renderer.renderToSVG(tokens)
return svg
}