Skip to content

V0.14.9: protect pages from WYSIWYG-editor toggle damage#88

Merged
dibi73 merged 1 commit intomainfrom
release/v0.14.9
May 4, 2026
Merged

V0.14.9: protect pages from WYSIWYG-editor toggle damage#88
dibi73 merged 1 commit intomainfrom
release/v0.14.9

Conversation

@dibi73
Copy link
Copy Markdown
Owner

@dibi73 dibi73 commented May 4, 2026

Summary

Three-layer defence against BookStack's WYSIWYG-editor round-trip destroying our marker comments:

  • merge.py:MergeResult.markers_missing: detects pages with non-empty body + known stored hash + at least one missing marker. sync.py skips those pages instead of clobbering user content; new markers_missing_page_keys/_titles lists carry them into the sync report. coordinator._reconcile_markers_missing_issues reconciles a dedicated page_markers_missing repair issue (registry as source of truth, same shape as the tamper reconciler). force=True bypasses the skip — same escape hatch as for tampering.
  • api.create_page / update_page send editor: "markdown" on every write. Newer BookStack versions hide / warn-against the WYSIWYG toggle on pages with this pin; older versions silently ignore unknown fields, so it's defensive.
  • Documentation in user-visible spots: README + README.de.md get a prominent "edit only in markdown" warning. _strings.default_manual_body (DE+EN) now carries a ⚠ warning line inside every freshly-created MANUAL block — so the warning is ON the page itself, visible before the first WYSIWYG click.

Test plan

  • ruff check + ruff format --check green
  • pytest tests/ 205/205 green in WSL Ubuntu (was 195 — added 5 in test_merge.py:TestMarkersMissing, 2 in test_api.py for the editor pin, 2 in test_sync.py for skip + force-override)
  • Translation key-parity over all 28 locales for the new page_markers_missing issue
  • CI: lint + test + validate
  • Manual: install on a real HA instance, toggle a managed page to WYSIWYG and back, run bookstack_sync.run_now, verify the page is skipped + a Marker-Kommentare einer Page fehlen repair issue appears. Then re-run with force=true and verify the page is recreated.

🤖 Generated with Claude Code

BookStack's TinyMCE-based WYSIWYG editor round-trips Markdown through
HTML and silently drops the ``<!-- BEGIN AUTO-GENERATED -->`` comments
together with the original whitespace. Up to v0.14.8 the next sync
would happily overwrite the resulting page with a fresh AUTO block and
the placeholder MANUAL block — destroying whatever the user had typed
during the WYSIWYG session. This release adds three layers of defence:

(1) merge.py + sync.py: ``MergeResult.markers_missing`` flags pages
that have content + a known stored hash + at least one missing marker.
sync._sync_one skips those pages instead of overwriting them, the
report carries new ``markers_missing_page_keys/_titles`` lists, and
the coordinator reconciles a separate ``page_markers_missing`` repair
issue (registry as source of truth, same shape as the tamper
reconciler). ``force=True`` bypasses the skip on the user's explicit
opt-in, identical to the tamper escape hatch.

(2) api.py: every create_page/update_page now sends
``editor: "markdown"`` in the request body. Newer BookStack versions
honour it as a per-page editor pin so the WYSIWYG toggle is hidden
or warned-against in the page UI; older versions silently ignore the
field. Defensive — costs nothing, gains protection where BookStack
offers it.

(3) Documentation in the spots users actually read first:
README + README.de.md gain a prominent "edit only in markdown" warning
in the Known limitations / Manuelle Notizen sections, and
``_strings.default_manual_body`` (DE+EN) now carries a ⚠ warning line
inside every newly-created MANUAL block placeholder — so the warning
sits on the page itself, visible before the first WYSIWYG click.

Tests: 205/205 green (was 195) — 5 new in test_merge.py for the
markers_missing detection paths, 2 in test_api.py for the editor pin,
2 in test_sync.py for skip + force-override.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dibi73 dibi73 merged commit 1aab771 into main May 4, 2026
4 checks passed
@dibi73 dibi73 deleted the release/v0.14.9 branch May 4, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant