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 }) { 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) => { // console.log(_, 'a', a, 'b', b); return `${a}${b ? `#${b}` : ''}`; }); return ( <> {!!h && {item.longname}}
{item.examples?.length ? (
{item.examples?.map((example, k) => ( ))}
) : (
)} ); }