MCPcopy Index your code
hub / github.com/coder/coder / extractSectionName

Function extractSectionName

scripts/apidocgen/postprocess/main.go:253–261  ·  view source on GitHub ↗
(section []byte)

Source from the content-addressed store, hash-verified

251}
252
253func extractSectionName(section []byte) (string, error) {
254 scanner := bufio.NewScanner(bytes.NewReader(section))
255 if !scanner.Scan() {
256 return "", xerrors.Errorf("section header was expected")
257 }
258
259 header := scanner.Text()[2:] // Skip #<space>
260 return strings.TrimSpace(header), nil
261}
262
263func toMdFilename(sectionName string) string {
264 return nonAlphanumericRegex.ReplaceAllLiteralString(strings.ReplaceAll(strings.ToLower(sectionName), " ", ""), "-") + ".md"

Callers 1

writeDocsFunction · 0.85

Calls 3

ScanMethod · 0.45
ErrorfMethod · 0.45
TextMethod · 0.45

Tested by

no test coverage detected