docs(16-03): todo for Journal HTML content re-save

This commit is contained in:
2026-10-09 18:45:59 +02:00
parent 719830410e
commit 6ff7d5da3e

View File

@@ -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 `<!-- raw HTML omitted -->`, so the post body is wiped (probe in 16-RESEARCH.md: `pl HTML content -> out="<!-- raw HTML omitted -->\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.