fix: resolve JavaScript syntax error in md-render --edit mode fallback
Fixed critical JavaScript syntax error in the markdown fallback parser where literal newlines were being inserted into regex patterns, breaking JavaScript execution entirely in edit mode. Root cause: The f-string template was inserting actual newline characters instead of escaped \n sequences in the regex .replace(/\n\n/g, ...) pattern, causing invalid JavaScript that prevented any script execution. Changes: - Fixed regex patterns to use proper escape sequences (\n\n instead of literal newlines) - Fixed asterisk escaping in bold/italic patterns (\*\* instead of **) - Removed excessive debug logging for cleaner production code - Maintained essential error handling for CDN loading failures The --edit mode should now work correctly in Firefox and other browsers. Fixes #154: Html generated by "md-render --edit" does not show in firefox 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -560,7 +560,9 @@ class DocumentManager:
|
||||
contentDiv.innerHTML = marked.parse(markdownContent);
|
||||
}} else {{
|
||||
console.error('Failed to render markdown: marked library not loaded');
|
||||
contentDiv.innerHTML = '<p>Error: Markdown parser not available</p>';
|
||||
if (contentDiv) {{
|
||||
contentDiv.innerHTML = '<p>Error: Markdown parser not available</p>';
|
||||
}}
|
||||
}}
|
||||
{'// Initialize editor if in edit mode' if edit_mode else ''}
|
||||
{'if (typeof MARKITECT_EDIT_MODE !== \'undefined\' && MARKITECT_EDIT_MODE) {' if edit_mode else ''}
|
||||
|
||||
Reference in New Issue
Block a user