@@ -10,7 +10,6 @@ import (
1010
1111const (
1212 rootRegistryPath = "./registry"
13- fence = "---"
1413
1514 // validationPhaseFileStructureValidation indicates when the entire Registry
1615 // directory is being verified for having all files be placed in the file
@@ -33,7 +32,7 @@ const (
3332
3433var (
3534 supportedAvatarFileFormats = []string {".png" , ".jpeg" , ".jpg" , ".gif" , ".svg" }
36- // TODO: an example of what this regex matches would be useful, I think it's just
35+ // Matches markdown headers, must be at the beginning of a line, such as "# " or "### ".
3736 readmeHeaderRe = regexp .MustCompile ("^(#{1,})(\\ s*)" )
3837)
3938
@@ -55,6 +54,8 @@ func separateFrontmatter(readmeText string) (string, string, error) {
5554 return "" , "" , errors .New ("README is empty" )
5655 }
5756
57+ const fence = "---"
58+
5859 fm := ""
5960 body := ""
6061 nextLine := ""
@@ -100,8 +101,8 @@ func validateReadmeBody(body string) []error {
100101 return []error {errors .New ("README body is empty" )}
101102 }
102103
103- // If the very first line of the README, there's a risk that the rest of the validation logic will break, since we
104- // don't have many guarantees about how the README is actually structured.
104+ // If the very first line of the README doesn't start with an ATX-style H1 header , there's a risk that the rest of the
105+ // validation logic will break, since we don't have many guarantees about how the README is actually structured.
105106 if ! strings .HasPrefix (trimmed , "# " ) {
106107 return []error {errors .New ("README body must start with ATX-style h1 header (i.e., \" # \" )" )}
107108 }
0 commit comments