Put a linked heading at the top of the view

A heading link showed its heading in the center of the view, also for a
heading in another file. The text to read then started low on the
screen. An outline jump used the same scroll.

- Write and Source put a heading target at the top, with a gap of 24
  pixels. Other targets, such as a search match or a backlink, stay in
  the center.
- Read puts the heading at the top. The scroll margin of the heading
  keeps the gap.

The sectionLinks smoke test checks the position in Write and Read, also
for a heading in another file. Card bf263f80.
This commit is contained in:
Knotty Wyvern
2026-11-03 00:23:17 -07:00
parent 0ab7fe0c64
commit 18031e34e4
4 changed files with 27 additions and 5 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ Read follows CommonMark: a single line break inside a paragraph is a space. To s
- Ctrl+click a link in Write or Source. In Read, a normal click follows the link.
- A workspace file link opens in a new tab and keeps the current document open.
- A heading link, such as `guide.md#save-your-work` or `#save-your-work`, scrolls to that heading.
- A heading link, such as `guide.md#save-your-work` or `#save-your-work`, puts that heading at the top of the view. A heading near the end of a short document stays lower.
- A wiki link, such as `[[Meeting notes]]`, finds the note by name anywhere in the workspace. If two notes have the same name, use a relative or workspace path.
- The **Backlinks** section below the outline lists notes that link to the current note. Select an entry to open it.