commit 2c6e876e0971ad99698cc2f37f3db67525cc5473
parent e9c807693f3fea77674bb39fc0926f918e8250dd
Author: gearsix <gearsix@tuta.io>
Date: Mon, 18 Oct 2021 11:12:43 +0100
files with no file extension are now treated as <pre> text file
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/page.go b/page.go
@@ -110,7 +110,8 @@ func titleFromPath(path string) (title string) {
return
}
-var contentExts = [5]string{
+var contentExts = [6]string{
+ "", // pre-formatted text
".txt", // plain-text
".html", // HTML
".md", // commonmark + extensions (linkify, auto-heading id, unsafe HTML)
@@ -293,6 +294,8 @@ func (p *Page) NewContentFromFile(fpath string) (err error) {
for _, lang := range contentExts {
if filepath.Ext(fpath) == lang {
switch lang {
+ case "":
+ body = "<pre>"+string(buf)+"</pre>"
case ".txt":
body = convertTextToHTML(bytes.NewReader(buf))
case ".md":