-
I am using Codehike with Docusaurus. I would like to add tooltips. The example in the docs show us checking the props on the which contains a async function CodeWithTooltips(props: unknown) {
const { code, tooltips = [] } = parseProps(props, Schema)
const highlighted = await highlight(code, theme) However, in docusaurus, we seem to only have access to Thank you export function MyCode({ codeblock }: { codeblock: HighlightedCode }) {
return (
<div>
<Pre
code={codeblock}
handlers={[callout]}
style={{ background: "#212121", color: "#fafafa" }}
/>
</div>
)
} I referenced the docusaurus config here: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Yes, you don't need to call Also, you need to change the const Schema = Block.extend({
code: HighlightedCodeBlock,
tooltips: z.array(Block).optional(),
})
function CodeWithTooltips(props: unknown) {
const { code, tooltips = [] } = parseProps(props, Schema)
const highlighted = code
... |
Beta Was this translation helpful? Give feedback.
You can use any tooltip component, or build your own, it's not tied to shadcn.
I recommend you start from the
callout
example, and convert it into a tooltip. Once you have that, try to adapt the tooltip example from the docs, which is more complex but more powerful.