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 anchor link support within detection / jumping / completions #24

Closed
SidOfc opened this issue Apr 28, 2018 · 0 comments
Closed

Add anchor link support within detection / jumping / completions #24

SidOfc opened this issue Apr 28, 2018 · 0 comments
Assignees
Labels
feature:request Requesting new and additions to existing features.

Comments

@SidOfc
Copy link
Owner

SidOfc commented Apr 28, 2018

This is a proposal to add support to detect these types of links:
Currently, some work can be found in: https://github.com/SidOfc/mkdx/tree/patch/fragment-detection

<a id="top-of-page"></a>


MD: Go to [top](#top-of-page)
HTML: Go to <a href="#top-of-page"></a>

On Github, it would be perfectly valid to go to https://github.com/[USER]/[REPO]#top-of-page but mkdx does not recognize these links as valid fragments. One thing to note with Github and manually inserting a fragment identifier is that the indexes of other (automatically generated) headings do not change. For example:

# This is a header

With some text

## This is a header

While the second header is a H2, the generated fragment will be "#this-is-a-header".
But since this is the second occurrence of this header, a "-[N+1]" suffix is appended.

When adding a fragment identifier like so:

# This is a header

With some text

<a id="this-is-a-header"></a>

## This is a header

This time there is an extra anchor using an "id" value of a header that already exists.
Instead of handling that scenario, GH seems to ignore it. The second occurrence of this header remains the same as in the previous example ("#this-is-a-header-1") and the "id" anchor is simply ignored all together. The only time one can jump to an <a id="..."> or <a name="..."> anchor is when no existing anchor for it exists.

@SidOfc SidOfc added the feature:request Requesting new and additions to existing features. label Apr 28, 2018
@SidOfc SidOfc self-assigned this Apr 28, 2018
@SidOfc SidOfc closed this as completed in 92cd634 Apr 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:request Requesting new and additions to existing features.
Projects
None yet
Development

No branches or pull requests

1 participant