When a markdown file is located inside a gitignored directory, Cursor no longer shows the preview button for that file. The preview button disappears entirely for any markdown file that is gitignored.
Steps to Reproduce
Create a directory and add it to .gitignore
Place one or more markdown (.md) files inside that gitignored directory
Open any of those markdown files in Cursor
Observe that the preview button is missing from the editor toolbar
Expected Behavior
The markdown preview button should appear regardless of whether the file is inside a gitignored directory or not. Gitignore status is a version control concern and should not affect editor features like markdown preview.
The root cause appears to be that Cursor ties the availability of the markdown preview button to git tracking status. In this case, the output directory for generated markdown documentation files is gitignored intentionally, which causes all markdown files within it to lose the preview button. A simple workaround is not available since the directory must remain gitignored.
Hey, thanks for the report. Quick clarification: the Preview button is not tied to git tracking or gitignore. There’s no link like that in the code.
What’s actually happening: Cursor has its own WYSIWYG Markdown editor (toggle Preview/Markdown in the tab), and it’s intentionally disabled for .md files whose path includes .cursor, .claude, or .codex. This is to avoid reformatting config or rules files in those folders, where the raw syntax matters (headings, frontmatter, indentation).
Most likely, your gitignored folder with generated docs sits under a path that includes one of those segments. That’s why it looks like it matches gitignore. To confirm:
Does the path for the broken files include .cursor, .claude, or .codex anywhere? Please share an example full path.
A screenshot of the toolbar for that file.
If yes, that’s expected behavior. Workarounds:
Open Preview to the Side via Cmd+K V or the command palette works for any .md, no matter the directory.
If you need docs in an excluded folder with rich preview, move them to a normal directory, or use a symlink to a folder without .cursor, .claude, or .codex in the name.
A request to make this list configurable has already been sent to the team, but I can’t share an ETA.
Got it, that explains everything. .claude/plans/... falls under the excluded directories, so the WYSIWYG editor doesn’t turn on there.
Until the list is configurable, you can use Cmd+K V Open Preview to the Side or the Command Palette. They work for any .md file no matter the directory. So you can still get a preview, just not via the toolbar button.
If anything else comes up, feel free to reach out.