MCPcopy
hub / github.com/npmx-dev/npmx.dev / renderMemberList

Function renderMemberList

server/utils/docs/render.ts:276–296  ·  view source on GitHub ↗
(title: string, items: DefinitionListItem[])

Source from the content-addressed store, hash-verified

274}
275
276function renderMemberList(title: string, items: DefinitionListItem[]): string {
277 const lines: string[] = []
278
279 if (items.length === 0) {
280 return ''
281 }
282
283 lines.push(`<div class="docs-members">`)
284 lines.push(`<h4>${title}</h4>`)
285 lines.push(`<dl>`)
286 for (const item of items) {
287 lines.push(`<dt><code>${escapeHtml(item.signature)}</code></dt>`)
288 if (item.description) {
289 lines.push(`<dd>${escapeHtml(item.description.split('\n')[0] ?? '')}</dd>`)
290 }
291 }
292 lines.push(`</dl>`)
293 lines.push(`</div>`)
294
295 return lines.join('\n')
296}
297
298/**
299 * Render class members (constructor, properties, methods).

Callers 1

renderClassMembersFunction · 0.85

Calls 1

escapeHtmlFunction · 0.90

Tested by

no test coverage detected