[Bug]: Internal Markdown links without # fragments open edit mode instead of preserving preview
- Dominant language
- TypeScript
- Stars
- 71.3k
- Forks
- 4.7k
- Avg merge
- 14h 54m
- Merged PRs (30d)
- 520
Description
## Operating system
macOS
## Orca version
1.4.188
## Details
### Short summary
Following a relative link from a rendered Markdown preview opens different destination modes depending only on whether the link contains a `#heading` fragment:
- `[Target](target.md)` opens the destination in **edit mode**.
- `[Target](target.md#heading)` opens the destination in **Markdown preview**.
The fragment should control scroll position, not whether navigation leaves the rendered reading surface. The current behavior is surprising and breaks the reading rhythm between linked documents.
### Reproduction
1. Create `source.md`:
```md
# Source
[Plain target](target.md)
[Anchored target](target.md#target)
```
2. Create `target.md`:
```md
# Target
Destination content.
```
3. Open `source.md` using **Open Markdown Preview**.
4. Click **Plain target**.
5. Observe that `target.md` opens in edit mode.
6. Return to the preview and click **Anchored target**.
7. Observe that the same file opens in rendered Markdown preview.
### Expected
Both links preserve Markdown preview. If a fragment is present, the preview additionally scrolls to that heading.
### Actual
The plain link opens an editor tab; only the anchored link opens a preview tab.
### Additional evidence
The packaged 1.4.188 renderer's Markdown document navigation branches on the presence of `options.anchor`: the anchored branch calls `openMarkdownPreview(...)`, while the no-anchor branch calls `openFile(..., mode: "edit")`.
This became particularly confusing with a long Markdown destination containing supported preview content but raw HTML that rich editing would not round-trip: the plain-link route landed in source editing, while manually choosing **Open Markdown Preview** rendered it correctly. That HTML fallback is separate; the core issue reproduces with the two minimal files above.
Contributor guide
Research direction
Start at the Markdown document navigation branch described in the report, where options.anchor selects openMarkdownPreview(...) and the no-anchor path calls openFile(..., mode: "edit"). Reproduce the behavior with the source.md and target.md files from the issue; done means both relative links preserve Markdown preview, with anchored links still scrolling to the heading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- markdown, typescript
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100