diff --git a/internal/api/audit.go b/internal/api/audit.go
index 18b8e09..9baa49f 100644
--- a/internal/api/audit.go
+++ b/internal/api/audit.go
@@ -27,6 +27,7 @@ import (
// routes missing here, so new endpoints cannot slip past the log.
var auditActions = map[string]string{
"POST /api/v1/locale": "",
+ "POST /api/v1/markdown/preview": "",
"POST /api/v1/auth/signup": "account.signup",
"POST /api/v1/auth/login": "auth.login",
"POST /api/v1/auth/login/totp": "auth.login",
diff --git a/internal/api/legal_test.go b/internal/api/legal_test.go
index 1a37075..96cef8b 100644
--- a/internal/api/legal_test.go
+++ b/internal/api/legal_test.go
@@ -126,3 +126,17 @@ func TestLegalChangeReachesOtherReplicas(t *testing.T) {
t.Error("the other replica still serves the old footer")
}
}
+
+func TestMarkdownPreview(t *testing.T) {
+ e := newEnv(t)
+ if st, _ := e.browser(t).do("POST", "/api/v1/markdown/preview", map[string]any{"markdown": "x"}); st != http.StatusUnauthorized {
+ t.Errorf("anonymous preview = %d, want 401", st)
+ }
+ b := e.browser(t)
+ b.signup("p@"+uniq("md")+".test", uniq("md-"))
+ st, body := b.do("POST", "/api/v1/markdown/preview", map[string]any{"markdown": "**hi** "})
+ html, _ := body["html"].(string)
+ if st != http.StatusOK || !strings.Contains(html, "hi") || strings.Contains(html, "", "", "
+
+