1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-11-27 05:54:44 +01:00
gojekyll/markdown.go

19 lines
530 B
Go
Raw Normal View History

package main
import (
"path/filepath"
"strings"
)
// IsMarkdown returns a boolean indicating whether the file is a Markdown file, according to the current project.
func (s *Site) IsMarkdown(path string) bool {
ext := filepath.Ext(path)
return s.MarkdownExtensions()[strings.TrimLeft(ext, ".")]
}
// MarkdownExtensions returns a set of markdown extension, without the final dots.
func (s *Site) MarkdownExtensions() map[string]bool {
extns := strings.SplitN(s.config.MarkdownExt, `,`, -1)
return stringArrayToMap(extns)
}