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'; const getTag = (title, item) => item.tags?.find((t) => t.title === title)?.text; export function JsDoc({ name, h = 3, hideDescription }) { const item = docs[name]; if (!item) { console.warn('Not found: ' + name); return
; } const synonyms = getTag('synonyms', item)?.split(', ') || []; 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 &&{synonyms.join(', ')}
)}
>
)}