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

Function renderKindSection

server/utils/docs/render.ts:73–91  ·  view source on GitHub ↗

* Render a section for a specific symbol kind.

(
  kind: string,
  symbols: MergedSymbol[],
  symbolLookup: SymbolLookup,
)

Source from the content-addressed store, hash-verified

71 * Render a section for a specific symbol kind.
72 */
73async function renderKindSection(
74 kind: string,
75 symbols: MergedSymbol[],
76 symbolLookup: SymbolLookup,
77): Promise<string> {
78 const title = KIND_TITLES[kind] || kind
79 const lines: string[] = []
80 const renderedSymbols = await Promise.all(
81 symbols.map(symbol => renderMergedSymbol(symbol, symbolLookup)),
82 )
83
84 lines.push(`<section class="docs-section" id="section-${kind}">`)
85 lines.push(`<h2 class="docs-section-title">${title}</h2>`)
86 lines.push(...renderedSymbols)
87
88 lines.push(`</section>`)
89
90 return lines.join('\n')
91}
92
93/**
94 * Render a merged symbol (with all its overloads).

Callers 1

renderDocNodesFunction · 0.85

Calls 1

renderMergedSymbolFunction · 0.85

Tested by

no test coverage detected