forked from tangled.org/core
this repo has no description
1package markup 2 3import "strings" 4 5type Format string 6 7const ( 8 FormatMarkdown Format = "markdown" 9 FormatText Format = "text" 10) 11 12var FileTypes map[Format][]string = map[Format][]string{ 13 FormatMarkdown: []string{".md", ".markdown", ".mdown", ".mkdn", ".mkd"}, 14} 15 16// ReadmeFilenames contains the list of common README filenames to search for, 17// in order of preference. Only includes well-supported formats. 18var ReadmeFilenames = []string{ 19 "README.md", "readme.md", 20 "README", 21 "readme", 22 "README.markdown", 23 "readme.markdown", 24 "README.txt", 25 "readme.txt", 26} 27 28func GetFormat(filename string) Format { 29 for format, extensions := range FileTypes { 30 for _, extension := range extensions { 31 if strings.HasSuffix(filename, extension) { 32 return format 33 } 34 } 35 } 36 // default format 37 return FormatText 38}