aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/handlers_sections.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web/handlers_sections.go')
-rw-r--r--internal/web/handlers_sections.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/web/handlers_sections.go b/internal/web/handlers_sections.go
index eb45e1c..77ac90d 100644
--- a/internal/web/handlers_sections.go
+++ b/internal/web/handlers_sections.go
@@ -6,7 +6,6 @@ import (
"strconv"
"strings"
- "github.com/gramanas/blogspace/internal/markdown"
"github.com/gramanas/blogspace/internal/store"
)
@@ -66,6 +65,7 @@ func (s *Server) handleSectionSave(w http.ResponseWriter, r *http.Request) {
}
sec.Title = strings.TrimSpace(r.FormValue("title"))
sec.BodyMD = strings.ReplaceAll(r.FormValue("body"), "\r\n", "\n")
+ sec.Format = pick(r.FormValue("format"), store.FormatMarkdown, store.FormatHTML)
sec.Placement = r.FormValue("column") + "-" + r.FormValue("position")
sec.Style = r.FormValue("style")
sec.Enabled = r.FormValue("enabled") == "on"
@@ -88,8 +88,8 @@ func (s *Server) handleSectionSave(w http.ResponseWriter, r *http.Request) {
fail(s.tr(r, "Announcement is too long (20 KB max)."))
return
}
- sec.BodyMD = appendFileMD(sec.BodyMD, img)
- sec.BodyHTML = markdown.Render(sec.BodyMD)
+ sec.BodyMD = appendFile(sec.BodyMD, img, sec.Format)
+ sec.BodyHTML = renderBody(sec.Format, sec.BodyMD)
if sec.ID == 0 {
sec, err = blogStore(r).CreateSection(r.Context(), sec)
} else {