MCPcopy Index your code
hub / github.com/github/github-mcp-server / replaceSection

Function replaceSection

cmd/github-mcp-server/generate_docs.go:342–360  ·  view source on GitHub ↗
(content, startMarker, endMarker, newContent string)

Source from the content-addressed store, hash-verified

340}
341
342func replaceSection(content, startMarker, endMarker, newContent string) (string, error) {
343 start := fmt.Sprintf("<!-- %s -->", startMarker)
344 end := fmt.Sprintf("<!-- %s -->", endMarker)
345
346 before, _, ok := strings.Cut(content, start)
347 endIdx := strings.Index(content, end)
348 if !ok || endIdx == -1 {
349 return "", fmt.Errorf("markers not found: %s / %s", start, end)
350 }
351
352 var buf strings.Builder
353 buf.WriteString(before)
354 buf.WriteString(start)
355 buf.WriteString("\n")
356 buf.WriteString(newContent)
357 buf.WriteString("\n")
358 buf.WriteString(content[endIdx:])
359 return buf.String(), nil
360}
361
362func generateRemoteToolsetsDoc() string {
363 var buf strings.Builder

Callers 4

rewriteAutomatedSectionFunction · 0.85
generateReadmeDocsFunction · 0.85
generateRemoteServerDocsFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected