Commit Graph

5 Commits

Author SHA1 Message Date
0d79ab1fef Replace custom markdown parser with marked.js v16.2.1
🚀 Major Upgrade: Professional markdown handling with marked.js

 Fixed Issues:
- No more recursion errors or browser crashes
- Proper handling of complex markdown (multiple links per line)
- Robust parsing of edge cases and nested formatting

🔧 Implementation:
- Added marked.js v16.2.1 via CDN to both HTML pages
- Custom renderer preserves button styling (btn-primary)
- Smart lead paragraph detection for styling preservation
- Intelligent element merging to maintain layout
- Removed all buggy custom parsing code (100+ lines)

🎯 New Capabilities:
- Multiple buttons per line: [Get Started](link1) [Or tomorrow](link2)
- Full CommonMark support (tables, lists, formatting)
- Better performance with optimized C-like parsing
- Extensible renderer system for future enhancements

 User Experience:
- Edit forms now handle complex markdown perfectly
- Layout and styling fully preserved after saves
- No more crashes when editing rich content
- Professional markdown processing

Ready to test the two-button hero scenario! 🚀
2025-08-30 12:37:45 +02:00
526c265e52 Fix infinite recursion in markdown parsing
🐛 Critical Fix: Maximum call stack exceeded error
 Solution: Properly handle regex match result in parseMarkdownToBlocks()

🔧 Issue:
- line.match(/^#+/)[0].length caused infinite recursion
- Browser crashed when editing rich content with headings

🔧 Fix:
- Store regex match result in variable first
- Add null check before accessing match result
- Prevents stack overflow when parsing markdown headings

 Now safe to edit content with # headings without crashes
2025-08-29 23:22:06 +02:00
dc70b74f7d Preserve layout and styling when applying edited content
🎯 Problem: Buttons and styling lost when saving rich content
 Solution: Smart content application that preserves HTML structure

🔧 New Features:
- parseMarkdownToBlocks() - Intelligently parses markdown
- updateRichContent() - Updates elements in place vs wholesale replacement
- canUpdateElement() - Checks element/content compatibility
- updateElementContent() - Preserves classes while updating content
- looksLikeButton() - Heuristics to detect and preserve button styling

🎨 Layout Preservation:
- Buttons keep their 'btn-primary' classes and styling
- Headings maintain existing CSS classes and hierarchy
- Paragraphs preserve lead/subtitle classes
- Links maintain href and visual styling

 User Experience:
- Edit 'Get Started Today' button → still looks like a button after save
- Rich content maintains professional appearance
- No more plain text where buttons should be

Smart frontend content management without backend complexity!
2025-08-29 23:08:46 +02:00
04e669eb95 Fix edit form content extraction - show clean customer view
🐛 Problem: Edit forms showed client view with edit buttons/emojis
 Solution: Extract clean content without edit interface elements

🔧 Changes:
- extractContentFromElement() now properly removes all edit UI
- Improved htmlToMarkdown() for better rich content conversion
- setupEditableElement() preserves original clean content
- Enhanced whitespace normalization in markdown conversion
- Handles both simple text and rich markdown content types

🎯 User Experience:
- Client sees: Content with edit buttons (✏️)
- Edit form shows: Clean, properly formatted content
- Customer sees: Original clean content (no edit UI)

 Whitespace improvements:
- Removes excessive indentation and spacing
- Normalizes line breaks and paragraph spacing
- Clean, readable content in edit forms

Critical fix for proper edit-in-place functionality
2025-08-29 23:04:29 +02:00
af88e57272 Add working frontend prototype with edit-in-place functionality
 Features implemented:
- Complete demo website (Acme Consulting Services)
- Core insertr.js library with edit-in-place functionality
- Support for simple text and rich markdown content
- Mock authentication system (login/logout simulation)
- Edit mode toggle for client interface
- Local storage persistence
- Visual feedback for saving content
- Multi-page support (index.html, about.html)
- Responsive design with clean UI

🎯 Three user experiences:
- Customer: Clean website with no edit interface
- Client: Same website + edit buttons when authenticated
- Developer: Simple class-based integration

🏗️ Architecture:
- Vanilla JavaScript (no framework dependencies)
- Alpine.js ready for enhanced interactivity
- CSS-only styling for edit indicators
- Mock API structure for backend planning

Next: Connect to Go backend with real persistence
2025-08-29 22:41:15 +02:00