MCPcopy Index your code
hub / github.com/codeaashu/claude-code / extractMarkupText

Function extractMarkupText

src/tools/LSPTool/formatters.ts:223–248  ·  view source on GitHub ↗

* Extracts text content from MarkupContent or MarkedString

(
  contents: MarkupContent | MarkedString | MarkedString[],
)

Source from the content-addressed store, hash-verified

221 * Extracts text content from MarkupContent or MarkedString
222 */
223function extractMarkupText(
224 contents: MarkupContent | MarkedString | MarkedString[],
225): string {
226 if (Array.isArray(contents)) {
227 return contents
228 .map(item => {
229 if (typeof item === 'string') {
230 return item
231 }
232 return item.value
233 })
234 .join('\n\n')
235 }
236
237 if (typeof contents === 'string') {
238 return contents
239 }
240
241 if ('kind' in contents) {
242 // MarkupContent
243 return contents.value
244 }
245
246 // MarkedString object
247 return contents.value
248}
249
250/**
251 * Formats hover result

Callers 1

formatHoverResultFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected