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

Function isTopLevelKey

pkg/cli/yaml_frontmatter_utils.go:53–60  ·  view source on GitHub ↗

isTopLevelKey checks if a line is a top-level YAML key (no indentation, contains colon, not a comment)

(line string)

Source from the content-addressed store, hash-verified

51
52// isTopLevelKey checks if a line is a top-level YAML key (no indentation, contains colon, not a comment)
53func isTopLevelKey(line string) bool {
54 trimmed := strings.TrimSpace(line)
55 if trimmed == "" || strings.HasPrefix(trimmed, "#") {
56 return false
57 }
58 indent := getIndentation(line)
59 return indent == "" && strings.Contains(line, ":")
60}
61
62// isNestedUnder checks if currentLine is nested under (has more indentation than) parentIndent
63func isNestedUnder(currentLine, parentIndent string) bool {

Calls 1

getIndentationFunction · 0.85

Tested by 1

TestIsTopLevelKeyFunction · 0.68