diff --git a/markitect/document_manager.py b/markitect/document_manager.py index f9929244..1a80749c 100644 --- a/markitect/document_manager.py +++ b/markitect/document_manager.py @@ -560,7 +560,9 @@ class DocumentManager: contentDiv.innerHTML = marked.parse(markdownContent); }} else {{ console.error('Failed to render markdown: marked library not loaded'); - contentDiv.innerHTML = '

Error: Markdown parser not available

'; + if (contentDiv) {{ + contentDiv.innerHTML = '

Error: Markdown parser not available

'; + }} }} {'// Initialize editor if in edit mode' if edit_mode else ''} {'if (typeof MARKITECT_EDIT_MODE !== \'undefined\' && MARKITECT_EDIT_MODE) {' if edit_mode else ''}