Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add anchors to markdown rendered headers #6219
Fixes ACCEPTING MERGE/PULL REQUESTS at http://feedback.gitlab.com/forums/176466-general/suggestions/5158863-markdown-headers-should-have-proper-id-s-and-popup
I'll finish implementation and write the tests once we agree on how the UI should look exactly (lets continue discussion there).
By design choice, issue and MR comments' headers do not get IDs + links since:
All other markdown rendered headers should get IDs + links to those IDs:
If I forgot to check one place where markdown is rendered, please tell me.
The change was explained on the markdown documentation section, in particular, how exactly IDs are generated from the header content. Please see the diff for intended behaviour.
The major UI change is that on hover a header link image appears to the left of the header.
To do that, a bit of extra margin had to be added to the left of the markdown render container.
This is a sample from the issues:
Note how comments do not get IDs by design choice:
Except for that, the only other change was in help pages such as the markdown help, in which:
I feel that this makes the entire help more uniform, and has the bonus that all header links will be on the same vertical line.
Also headers on the toc were converted into boldface to not generate ID conflicts:
A section was added explaining the header IDs, in particular exactly how the IDs are calculated from the text.
The end user must know that in order to avoid ID conflicts:
Moved margins from
I have not added on hover / visibility tests they are not very portable on Capybara. If you feel that they are absolutely necessary, I can try to patch something up.
Moved markdown help page markdown tests from
Thanks for all the hard work @cirosantilli !
@randx can you respond to his questions which I listed below?
@cirosantilli thank you for this PR. Few notes
remove them. text should be aligned same as header. Add negative margin to anchor icon instead
leave as is. I dont like when Pull Request changes stuff not related to its title
@randx Sorry, I don't quite understand what you mean at "remove them. text should be aligned same as header. Add negative margin to anchor icon instead".
The header text is aligned same as the rest of the rest of the text as in the screen shots.
The margin was not added only to the headers, but to the entire preview container. If we want to have the links to the left like on the screenshot and GitHub, I don't see any other way around that, or else the link would appear above the container border.
Or do you want something different from the screenshot?
RSpec test have been failing on Travis CI due to 50min timeout on many unrelated branches I have pushed, and when they pass they are not far from 50min.
Locally RSpec tests pass in 20 min.
Is this not happening to other people also?
I am not sure what is the cause. Every time I checked new test pass dots
Maybe we just have to split RSpec tests into two batches as suggested in the Travis UI.
@cirosantilli I just tried this, but unfortunately on GitLab 6.7 this looks a bit strange: https://gitlab.com/razer6/test-repo/blob/master/README.rdoc
You see this jumping anchor when hovering. Can you take a look?
Definitely a bug. As far as you know:
Also, on hover there are 2 character links:
My dev install is broken for now, if anyone reproduces on master lets open an issue and link here.