From a350b96dd24965870fbc2d20f6eca0e9cc139691 Mon Sep 17 00:00:00 2001 From: tegwick Date: Wed, 15 Oct 2025 00:55:46 +0200 Subject: [PATCH] feat: implement graceful degradation and error reporting for md-render --edit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complete redesign of edit mode using progressive enhancement principles: ALWAYS WORKS: - Content is rendered server-side first (like regular mode) - Visible even if JavaScript completely fails - Fallback rendering if CDN is blocked USER-FRIENDLY ERROR REPORTING: - Visual status indicator shows edit mode state - Clear error messages displayed on page (not just console) - Browser info and GitHub issue link for bug reports - Helps users understand what's happening and how to help PROGRESSIVE ENHANCEMENT: - Step 1: Render content (guaranteed to work) - Step 2: Try to add edit capabilities (bonus feature) - If Step 2 fails, users still get full content + clear explanation This solves the core issue where users got blank pages when JavaScript failed, and provides much better debugging information for future issues. Addresses feedback on #154: Html generated by "md-render --edit" does not show in firefox 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- markitect/document_manager.py | 92 ++++++++++++++++++++++++++++++----- 1 file changed, 81 insertions(+), 11 deletions(-) diff --git a/markitect/document_manager.py b/markitect/document_manager.py index 1a80749c..5bb7fbe2 100644 --- a/markitect/document_manager.py +++ b/markitect/document_manager.py @@ -533,6 +533,27 @@ class DocumentManager: let markitectEditor;""" + # Edit mode status and error reporting section + edit_mode_html = "" + if edit_mode: + edit_mode_html = f""" +
+
📝 Markitect Edit Mode
+
Loading edit capabilities...
+ +
""" + html_template = f""" @@ -542,33 +563,82 @@ class DocumentManager: {css_content} {default_css} {editor_css} - + + {edit_mode_html}
"""