MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / summarizeCodeBlock

Function summarizeCodeBlock

packages/app-core/src/lib/code-block-copy.ts:118–123  ·  view source on GitHub ↗
(code: HTMLElement)

Source from the content-addressed store, hash-verified

116}
117
118function summarizeCodeBlock(code: HTMLElement): string {
119 const lineCount = countCodeLines(code.textContent ?? '')
120 const language = codeLanguageLabel(code)
121 const noun = lineCount === 1 ? 'line' : 'lines'
122 return `${language} folded (${lineCount} ${noun})`
123}
124
125function countCodeLines(text: string): number {
126 const normalized = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/\n$/, '')

Callers 1

ensureCodeBlockSummaryFunction · 0.85

Calls 2

countCodeLinesFunction · 0.85
codeLanguageLabelFunction · 0.85

Tested by

no test coverage detected