isAlphanumericID returns true if s is 3-8 lowercase alphanumeric chars with at least one digit. This avoids false-positives on English words like "readme".
(s string)
| 259 | // isAlphanumericID returns true if s is 3-8 lowercase alphanumeric chars with at least one digit. |
| 260 | // This avoids false-positives on English words like "readme". |
| 261 | func isAlphanumericID(s string) bool { |
| 262 | if len(s) < 3 || len(s) > 8 { |
| 263 | return false |
| 264 | } |
| 265 | hasDigit := false |
| 266 | for _, c := range s { |
| 267 | if c >= '0' && c <= '9' { |
| 268 | hasDigit = true |
| 269 | } else if c < 'a' || c > 'z' { |
| 270 | return false |
| 271 | } |
| 272 | } |
| 273 | return hasDigit |
| 274 | } |
| 275 | |
| 276 | // extractFrontmatter splits content into frontmatter and body |
| 277 | func extractFrontmatter(content []byte) (frontmatter []byte, body string, err error) { |
no outgoing calls