executablebooks / sphinx-proof

A Sphinx extension for producing proof, theorem, lemma, definition, remark, conjecture, corollary and algorithm directives.

Home Page:https://sphinx-proof.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clicking on ref link leads to wrong location

jstac opened this issue · comments

Maybe "wrong location" is an exaggeration, but what I mean is that if you click on a link that says "Theorem 1" in Chrome, you are directed to the theorem body, while the header "Theorem 1" is not visible --- it's off the top of the screen.

Hence it's not clear that you have been directed to the right place unless you scroll up.

Yes, I have noticed that as well. It's actually because of the main topbar which has a white background and it's almost the same height as the title div of the directive.

Is there any way to fix it you can think of?

@najuzilu would it help to wrap the whole theorem in another div and set the id=target to get link to the top of a theorem? @AakashGfude may be able to help on the html side of things here.

I think the easiest way might be to control the scroll behaviour using javascript and provide a bit of an offset to the location scrolled.
If @najuzilu is not working on this, I can give this one a shot.

I have a working solution for same-file targets, but I need to account for targets leading to different locations. I decided to go with JS and animate the scroll. How does that sound @AakashGfude?

sounds good @najuzilu . I guess it will be a more generic solution.