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

Layout of the page will hide part of the content when linking to an anchor #27

Open
ljacomet opened this issue Apr 8, 2016 · 2 comments
Labels

Comments

@ljacomet
Copy link
Member

ljacomet commented Apr 8, 2016

See for example http://www.ehcache.org/documentation/3.0/xml.html#code-cache-code-elements

@mathieucarbou
Copy link
Member

mathieucarbou commented Apr 19, 2016

See PR #39

I found that my fix works fine for http://localhost:4000/documentation/#resources_talks because the anchors have been correctly defined in the documentation page:

<a name="current_version" class="anchor" id="current_version"></a>

BUT here: http://localhost:4000/documentation/3.0/xml.html/#code-cache-code-elements

It does not work because there is simply no anchor at all.

<h3 id="code-cache-code-elements”>
    <a class="anchor" href="#code-cache-code-elements"></a>
    <code>&lt;cache&gt;</code> elements
</h3>

Here you only have an empty link.

I verified and the CSS works fine because the <a> element is moved 70px on top of the title, which is what is needed to make the fix work. The issue is that there is no name=“” attribute so that the browser can consider it as an anchor.

Just to confirm, I’ve replaced the above code by:

<h3>
    <a class="anchor" name="code-cache-code-elements"></a>
    <code>&lt;cache&gt;</code> elements
</h3>

And it worked fine :-)

So I don’t know if this empty link is the expected behavior, but if we really want it to be an anchor, then there is something to fix in the ehcache project perhaps ? I didn’t find where actually. I guess it is the way the asciidoc gets generated ?

For the moment, if we go to http://localhost:4000/documentation/3.0/xml.html/#code-cache-code-elements, Chrome simply tries to find an element with the given id, and scroll to it. That is why you get a bug, because it does not consider the anchor, there is none.

@mathieucarbou
Copy link
Member

I found a workaround, by using some JS to redefine the anchor names correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants