Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to jump to fragment identifiers within the document. #17

SidOfc opened this issue Apr 22, 2018 · 0 comments


None yet
1 participant
Copy link

commented Apr 22, 2018

This is a proposal to add the ability to jump from a fragment identifier to its header.
Since the table of contents can be generated as HTML inside a <details> tag, it would be nice to be able to jump from the generated <a href="#fragment">header text</a> links. It would also be nice to have the current cursor position added to the jumplist before jumping to the header. This way, one can jump back and forth between headers with `` / ctrl+O.

When the cursor is not currently positioned on a markdown/html link, it could default to using the first (fragment identifier) link found on the line. If executed and no link is present, nothing should happen.

Valid cursor positions

sample line with a [link](#to-a-heading)
valid position:    ^^^^^^^^^^^^^^^^^^^^^

sample line with a <a href="#to-a-heading"></a>
valid position:    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Both of these should go to a heading with the content: "To a heading" within the document.
If the cursor is not on a link, scan the line from left to right and visit the first fragment link found.
If no valid link is found, do nothing.


Aside from the base functionality, there should be a setting that allows you to opt-out of adding the cursor position before jumping to the jumplist in case you do not want the extra "junk" added. It could be located at:

let g:mkdx#settings.links.fragment.jumplist = 1

@SidOfc SidOfc self-assigned this Apr 22, 2018

SidOfc added a commit that referenced this issue Apr 22, 2018

Merge pull request #19 from SidOfc/feature/goto-header
Merge #17 - Feature/goto header

@SidOfc SidOfc closed this Apr 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.