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

Fix the "converters" header link in the README #291

Closed
wants to merge 4 commits into from
Closed

Fix the "converters" header link in the README #291

wants to merge 4 commits into from

Conversation

a2wd
Copy link
Contributor

@a2wd a2wd commented Dec 20, 2016

Added an anchor in the converters section heading for the link from the encodings section to point to (previously, the anchor tag/name attribute didn't exist so the link didn't do anything)

Added an anchor in the converters section heading for the link from the encodings section to point to (previously, the id didn't exist so the link didn't do anything)
@FagnerMartinsBrack
Copy link
Member

I don't understand what this do. All headers in Github markdown have links Can you please elaborate or record a video showing the difference? Thanks.

@FagnerMartinsBrack FagnerMartinsBrack added this to the v2.1.4 milestone Dec 22, 2016
@FagnerMartinsBrack
Copy link
Member

FagnerMartinsBrack commented Jan 9, 2017

Closing due to the lack of feedback from the OP. If you want to continue the discussion, please comment here mentioning one of the project members.

@FagnerMartinsBrack FagnerMartinsBrack removed this from the v2.1.4 milestone Jan 9, 2017
@a2wd
Copy link
Contributor Author

a2wd commented Jan 9, 2017

@FagnerMartinsBrack sorry for the delay, I've added a screengrab (below) unless it gets compressed, full size you should be able to see the difference - the left is the version in this PR, the right if the current master.

comparison

@FagnerMartinsBrack
Copy link
Member

Shouldn't it be #converters with an s in the end? See https://github.com/js-cookie/js-cookie/tree/b1f0a45ac82c892442215fd3cc54877465f3ae8b#converters

@FagnerMartinsBrack
Copy link
Member

FagnerMartinsBrack commented Jan 9, 2017

Probably the fix is in the link, not the header. The link should point to #converters instead.

@FagnerMartinsBrack
Copy link
Member

It looks like this typo has existed since June 2016 when it was added. See the "Encoding" section in the context of that revision.

@FagnerMartinsBrack FagnerMartinsBrack added this to the v2.1.4 milestone Jan 9, 2017
@a2wd
Copy link
Contributor Author

a2wd commented Jan 9, 2017

In that revision and previous ones I looked at it doesn't appear to have an anchor or name. The github markdown generator does add a custom #user-content-converters anchor nearby the heading though, but presumably that's not what you want to link to?

@FagnerMartinsBrack
Copy link
Member

In that revision and previous ones I looked at it doesn't appear to have an anchor or name.

Maybe Github does some magic, the important thing is that it works even without an id in the header element:

screenshot 2017-01-09 21 32 56

(Don't ask me why)

The github markdown generator does add a custom #user-content-convertors anchor nearby the heading though, but presumably that's not what you want to link to?

That's not what we should link to. That's Github generated markup. We shouldn't be adding to the project's Markdown level something that is of knowledge of Github only. Github can change the id="user-content-converters" at any time, the raw HTML is strictly internal behavior of Github, and it has the same problem as when we rely on library internals.

In this case, the best approach is to simulate the same link that Github adds when you click on the anchor in the left side of the title, see the image below:

screenshot 2017-01-09 21 26 16

That link points to https://github.com/js-cookie/js-cookie/tree/4e77d05b59692b664fe869f3e2dd54b77c13badf#converters

The likelihood of Github supporting their header generated anchor format is much higher than supporting a consistent generated HTML markup. Since they don't explicitly document that anchor and how link to them (or at least I'm not aware of any docs about it) this is still internal, but it's using an internal that if changed will also break several other projects out there. For that reason, it's safer than inspecting the HTML markup and linking to a custom anchor tag like #user-content-converters.

The <a name="converter"></a> is also a good approach because it ensures we have control of the element id. However, it mixes HTML with markdown but no apparent benefit while also breaking consistency with the rest of the file.

Given the tradeoffs, fixing the line 145 to point to [converter](#converters) seems to be the best approach in this case.

Make sense?

@a2wd
Copy link
Contributor Author

a2wd commented Jan 15, 2017

@FagnerMartinsBrack as discussed, I attempted with a change to #converters but that doesn't help either - you can see this at https://github.com/a2wd/js-cookie/blob/master/README.md#converters

Copy link
Member

@FagnerMartinsBrack FagnerMartinsBrack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FagnerMartinsBrack as discussed, I attempted with a change to #converters but that doesn't help either - you can see this at https://github.com/a2wd/js-cookie/blob/master/README.md#converters

It doesn't work with your link because you have changes in the header where there's an additional space on it before the tag you have added in the markdown, so the header anchor is interpreted as #converters- instead of #converters. Here's the same link you posted but now working: https://github.com/a2wd/js-cookie/blob/master/README.md#converters-

By the way, according to the contributing guidelines, we require PRs to be open using a topic/feature branch instead of master. See this for additional info: https://help.github.com/articles/about-pull-requests/

README.md Outdated
@@ -225,7 +225,7 @@ Cookies.get('name'); // => 'value'
Cookies.remove('name', { secure: true });
```

## Converters
## Converters <a name="converter"></a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As explained in the submitted review, if you remove <a name="converter"></a>, then the link will just work.

@FagnerMartinsBrack
Copy link
Member

Ping @a2wd. Are you still looking into this?

@a2wd
Copy link
Contributor Author

a2wd commented Feb 17, 2017

Again, sorry for the delay - this is now done and working 👍

@FagnerMartinsBrack FagnerMartinsBrack changed the title Minor usability improvement to the readme.md Fix the "converters" header link in the README Apr 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants