Skip to content
quarry Artifact [8dfa9ed879]
Login

Artifact [8dfa9ed879]

Artifact 8dfa9ed879f94d9c71abdd2ace0ce0aabcbc7c039b4ed90e8a00725f237ede14:


package web

import "strings"

// renderedByDefault says a file opens on its rendered page rather than
// its source: the documents fossil's /file renders unless asked for the
// text (Markdown, fossil wiki, HTML, Pikchr). Plain text is its own
// source, and opens as one.
func renderedByDefault(path string) bool {
	dot := strings.LastIndex(path, ".")
	if dot < 0 {
		return false
	}
	switch strings.ToLower(path[dot+1:]) {
	case "md", "markdown", "wiki", "html", "htm", "pikchr":
		return true
	}
	return false
}