This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / appview / pages / markup / format.go
540 B 27 lines
1package markup 2 3import ( 4 "regexp" 5) 6 7type Format string 8 9const ( 10 FormatMarkdown Format = "markdown" 11 FormatText Format = "text" 12) 13 14var FileTypePatterns = map[Format]*regexp.Regexp{ 15 FormatMarkdown: regexp.MustCompile(`(?i)\.(md|markdown|mdown|mkdn|mkd)$`), 16} 17 18// GetFormat returns the Format whose extension list matches filename, 19// falling back to FormatText. 20func GetFormat(filename string) Format { 21 for format, pattern := range FileTypePatterns { 22 if pattern.MatchString(filename) { 23 return format 24 } 25 } 26 return FormatText 27}