MCPcopy
hub / github.com/cli/cli / detectFrontmatter

Function detectFrontmatter

pkg/githubtemplate/github_template.go:130–135  ·  view source on GitHub ↗
(c []byte)

Source from the content-addressed store, hash-verified

128var yamlPattern = regexp.MustCompile(`(?m)^---\r?\n(\s*\r?\n)?`)
129
130func detectFrontmatter(c []byte) []int {
131 if matches := yamlPattern.FindAllIndex(c, 2); len(matches) > 1 {
132 return []int{matches[0][0], matches[1][1]}
133 }
134 return []int{-1, -1}
135}

Callers 3

ExtractNameFunction · 0.85
ExtractTitleFunction · 0.85
ExtractContentsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected