import jsdoc from '../../../doc.json'; // doc.json is built with `npm run jsdoc-json` const docs = jsdoc.docs.reduce((acc, obj) => Object.assign(acc, { [obj.longname]: obj }), {}); import { MiniRepl } from './MiniRepl'; export function JsDoc({ name, h = 3, hideDescription, punchcard, canvasHeight }) { const item = docs[name]; if (!item) { console.warn('Not found: ' + name); return
; } const CustomHeading = `h${h}`; const description = item.description?.replaceAll(/\{@link ([a-zA-Z\.]+)?#?([a-zA-Z]*)\}/g, (_, a, b) => { return `${a}${b ? `#${b}` : ''}`; }) || ''; return ( <> {!!h && {item.longname}} {!hideDescription && ( <> {!!item.synonyms_text && ( Synonyms: {item.synonyms_text} )}
)} {item.examples?.length ? (
{item.examples?.map((example, k) => ( ))}
) : (
)} ); }