V0.14.9: protect pages from WYSIWYG-editor toggle damage#88
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.pyskips those pages instead of clobbering user content; newmarkers_missing_page_keys/_titleslists carry them into the sync report.coordinator._reconcile_markers_missing_issuesreconciles a dedicatedpage_markers_missingrepair issue (registry as source of truth, same shape as the tamper reconciler).force=Truebypasses the skip — same escape hatch as for tampering.api.create_page/update_pagesendeditor: "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._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 --checkgreenpytest tests/205/205 green in WSL Ubuntu (was 195 — added 5 intest_merge.py:TestMarkersMissing, 2 intest_api.pyfor the editor pin, 2 intest_sync.pyfor skip + force-override)page_markers_missingissuebookstack_sync.run_now, verify the page is skipped + aMarker-Kommentare einer Page fehlenrepair issue appears. Then re-run withforce=trueand verify the page is recreated.🤖 Generated with Claude Code