File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -545,6 +545,11 @@ def _handle_link(self, message: Markdown.LinkClicked) -> None:
545545 # off, on the off-chance that there's an anchor involved still...
546546 file_name , _ , anchor = message .href .partition ("#" )
547547
548+ # Some sort of internal anchor perhaps?
549+ if anchor and not file_name :
550+ message .markdown .goto_anchor (anchor )
551+ return
552+
548553 # A local file that exists?
549554 if (local_file := Path (file_name ).expanduser ()).exists ():
550555 self .post_message (OpenLocation (local_file .resolve ()))
@@ -560,10 +565,6 @@ def _handle_link(self, message: Markdown.LinkClicked) -> None:
560565 self .post_message (OpenLocation (local_file ))
561566 return
562567
563- # Some sort of internal anchor perhaps?
564- if anchor and message .markdown .goto_anchor (anchor ):
565- return
566-
567568 # TODO: One case that isn't yet handled is a file name that also has
568569 # an anchor: `some-file.md#some-anchor`. We should handle that too
569570 # at some point.
You can’t perform that action at this time.
0 commit comments