addHoverDescriptions
addHoverDescriptions(
codeBlock,callback,options):void
Defined in: client/hover.ts:44
Utility that makes it easier to add hover descriptions to tokens.
Parameters
Section titled “Parameters”codeBlock
Section titled “codeBlock”Code block to add the functionality to.
callback
Section titled “callback”(types, language, text, element) => (string | Node)[] | null | undefined
Function called when a token with only textual children is hovered.
The function gets called with the following arguments:
types: Array with the token’s type as the first element, followed by any alises.language: The language at the token’s position.text: ThetextContentof the token.element: The<span>element of the hovered token.
Lastly, the function should return an array of children that get added to the tooltip.
If null or undefined is returned, no tooltip is shown for the token.
options
Section titled “options”HoverOptions = {}
Options for configuring the size and position of the tooltip.
Returns
Section titled “Returns”void