fix: Use parseMarkdown instead of marked.parse for comment preview

Fixed markdown preview for comments by replacing marked.parse() calls
with parseMarkdown() function. The application uses a custom markdown
parser (markdown.js), not the marked.js library.

Changes:
- togglePreview(): Use parseMarkdown() instead of marked.parse()
- updatePreview(): Use parseMarkdown() instead of marked.parse()

Resolves issue where markdown preview didn't work for comments but
worked after posting.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-13 15:16:02 -05:00
parent ee69b9094b
commit 496e8d6c21

View File

@@ -224,7 +224,7 @@ function togglePreview() {
preview.style.display = isPreviewEnabled ? 'block' : 'none';
if (isPreviewEnabled) {
preview.innerHTML = marked.parse(textarea.value);
preview.innerHTML = parseMarkdown(textarea.value);
textarea.addEventListener('input', updatePreview);
} else {
textarea.removeEventListener('input', updatePreview);
@@ -237,8 +237,8 @@ function updatePreview() {
const isMarkdownEnabled = document.getElementById('markdownMaster').checked;
if (isMarkdownEnabled && commentText.trim()) {
// For markdown preview, use marked.parse which handles line breaks correctly
previewDiv.innerHTML = marked.parse(commentText);
// For markdown preview, use parseMarkdown which handles line breaks correctly
previewDiv.innerHTML = parseMarkdown(commentText);
previewDiv.style.display = 'block';
} else {
previewDiv.style.display = 'none';