UNPKG

@hypothesis/frontend-shared

Version:

Shared components, styles and utilities for Hypothesis projects

25 lines (24 loc) 823 B
/** * Render a JSX expression as a code string. * * Currently this only supports serializing props with simple types (strings, * booleans, numbers). * * @example * jsxToString(<Widget expanded={true} label="Thing"/>) // returns `<Widget expanded label="Thing"/>` * * @param {import('preact').ComponentChildren} vnode * @return {string} */ export function jsxToString(vnode: import('preact').ComponentChildren): string; /** * Render a JSX expression as syntax-highlighted HTML markup. * * For the syntax highlighting to be visible, a Highlight.js CSS stylesheet must be * loaded on the page. * * @param {import('preact').ComponentChildren} vnode - JSX expression to render. * See {@link jsxToString} * @return {string} */ export function jsxToHTML(vnode: import('preact').ComponentChildren): string;