Bug Report: Preview Mode Strips Content and Formatting When Switching Back to Markdown Mode

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When switching between Markdown preview mode and edit mode in Cursor IDE, the in-place preview toggle permanently strips or alters content: HTML comments, HTML elements (e.g. page-break divs), and underscore placeholder lines. Table formatting may also be altered. Changes are written to disk without warning. Verifiable via git diff. See Additional Information for examples.

Steps to Reproduce

  1. Open a Markdown file containing HTML comments, inline HTML (e.g. page-break divs), underscore placeholders (_______________________________________________________________________________), or custom table alignment. See Additional Information for example syntax.
  2. Switch to preview mode using the in-place preview toggle (magnifying glass icon).
  3. Switch back to edit mode (raw Markdown).
  4. Save the file (or rely on auto-save).
  5. Compare with git diff — content is stripped or altered.

Expected Behavior

The file content should be identical before and after toggling. The preview should be a read-only view. No user-authored content (HTML comments, HTML elements, placeholders) should be removed or altered.

Operating System

Windows 10/11

Version Information

Version: 2.6.11 (user setup)
VSCode Version: 1.105.1
Commit: 8c95649f251a168cc4bb34c89531fae7db4bd990
Date: 2026-03-03T18:57:48.001Z
Build Type: Stable
Release Track: Early Access
Electron: 39.6.0
Chromium: 142.0.7444.265
Node.js: 22.22.0
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200

Additional Information

Example diff (HTML comments stripped):

- <!-- @review: verify this section before finalizing -->
-
 ## Next Section

Example (underscore placeholders replaced with —):

- _______________________________________________________________________________
+ ---

Workaround: Avoid in-place preview toggle for files with HTML/comments/placeholders; use classic side-pane preview (Ctrl+Shift+V). Keep files under version control.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the detailed report. The repro steps and diffs are really helpful.

This looks like a real bug with the in-place Markdown preview toggle (the magnifying glass icon). When you switch back to edit mode, the WYSIWYG layer seems to re-serialize the Markdown, which strips raw HTML (comments, divs), replaces underscore lines, and may change table formatting.

I flagged this with the team.

For now, the workaround you found is the right one. Use the classic side-pane preview Ctrl+Shift+V instead of the in-place toggle for files with HTML or special formatting. Unfortunately, there’s no setting to disable the WYSIWYG preview entirely, so avoiding the in-place toggle button is currently the only reliable way to prevent data loss.

Let me know if you run into anything else.

1 Like

I’m seeing the same bug on MacOS as well. The issue is most noticeable in tables, where the formatting, spacing, lines, etc are changed heavily.

Version: 2.6.19

VSCode Version: 1.105.1