From 6ff7d5da3ed237181f347d94f75a5b9877306ad3 Mon Sep 17 00:00:00 2001 From: Jakub Zych Date: Fri, 9 Oct 2026 18:45:59 +0200 Subject: [PATCH] docs(16-03): todo for Journal HTML content re-save --- .../journal-imported-html-admin-resave.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .planning/todos/pending/journal-imported-html-admin-resave.md diff --git a/.planning/todos/pending/journal-imported-html-admin-resave.md b/.planning/todos/pending/journal-imported-html-admin-resave.md new file mode 100644 index 0000000..8134a07 --- /dev/null +++ b/.planning/todos/pending/journal-imported-html-admin-resave.md @@ -0,0 +1,18 @@ +--- +title: Keep imported HTML post bodies intact when a Journal post is re-saved in the admin +date: 2026-10-09 +priority: high +area: sm-journal-plugin +--- + +Phase 16 RESEARCH Pitfall 2. The PHP journal export carries the pl post `content` as **HTML** (61 of 63 published posts on grzybyfunkcjonalne.pl). `journal:import-posts` stores it as is and the pl `content_html` is correct, so imported posts render fine. But an admin save of such a post runs `FormatHTML(content)`: goldmark without `html.WithUnsafe()` replaces raw HTML with ``, so the post body is wiped (probe in 16-RESEARCH.md: `pl HTML content -> out="\n"`). + +Until this is fixed, **do not edit imported posts in `/gfadmin`** (the sm-grzybyfunkcjonalne-app README repeats the warning). + +Fix in `sm-journal-plugin`, one of: + +- convert HTML content to markdown at import (an HTML-to-markdown step in `journal:import-posts`), or +- pass raw HTML through on save when the stored content is HTML (detect it, keep the three-pattern `CheckHTML` gate, skip goldmark), or +- add a content format flag on the post so HTML-sourced posts are edited as HTML. + +Whatever the fix, it must keep the XSS gate (`classes.CheckHTML`) on every write path and keep the PHP API contract of `content`/`content_html` unchanged. Add a test that re-saves an imported HTML post and asserts `content_html` is unchanged.