MCPcopy Create free account
hub / github.com/github/gh-aw / detectFrontmatterIndent

Function detectFrontmatterIndent

pkg/cli/codemod_run_install_scripts.go:167–179  ·  view source on GitHub ↗

detectFrontmatterIndent returns the indentation unit used in the YAML frontmatter by examining the first indented non-empty, non-comment line. Defaults to two spaces.

(lines []string)

Source from the content-addressed store, hash-verified

165// detectFrontmatterIndent returns the indentation unit used in the YAML frontmatter
166// by examining the first indented non-empty, non-comment line. Defaults to two spaces.
167func detectFrontmatterIndent(lines []string) string {
168 for _, line := range lines {
169 trimmed := strings.TrimSpace(line)
170 if trimmed == "" || strings.HasPrefix(trimmed, "#") {
171 continue
172 }
173 ind := getIndentation(line)
174 if len(ind) > 0 {
175 return ind
176 }
177 }
178 return " "
179}

Callers 1

Calls 1

getIndentationFunction · 0.85

Tested by

no test coverage detected