Skip to content

Commit

Permalink
Support jumping to a document heading
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Mar 27, 2024
1 parent 53784d5 commit 4a5e7f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

- Front matter is now ignored when viewing a file.
[#15](https://github.com/Textualize/frogmouth/issues/15)
- Added support for jumping to an internal anchor.
[#91](https://github.com/Textualize/frogmouth/issues/91)

## [0.9.2] - 2023-11-28

Expand Down
6 changes: 6 additions & 0 deletions frogmouth/screens/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,12 @@ def on_markdown_link_clicked(self, event: Markdown.LinkClicked) -> None:
# document we found it exists in the local filesystem, so let's
# assume that's what we're supposed to handle.
self.visit(local_file)
elif event.href.startswith("#") and event.markdown.goto_anchor(event.href[1:]):
# The href started with a # and the remains of it were satisfied
# as an anchor within the document of the Markdown. We should
# have scrolled to about the right spot in the document so we
# don't need to do anything else.
pass
else:
# Yeah, not sure *what* this link is. Rather than silently fail,
# let's let the user know we don't know how to process this.
Expand Down

0 comments on commit 4a5e7f5

Please sign in to comment.