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)
| 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. |
| 167 | func 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 | } |
no test coverage detected