|
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: |
Answered by
pomber
Sep 10, 2024
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
... |
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use any tooltip component, or build your own, it's not tied to shadcn.
I recommend you start from the
calloutexample, 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.