Skip to content

Fix anchor tag padding on link #148

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 51 additions & 47 deletions pydata_sphinx_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{% block sidebarsourcelink %}{% endblock %}

{% block body_tag %}
<body data-spy="scroll" data-target="#bd-toc-nav" data-offset="80">
<body>
{%- endblock %}
{%- block content %}
{% block docs_navbar %}
Expand All @@ -42,55 +42,59 @@
</nav>
{% endblock %}

<div class="container-xl">
<div class="row">
{% block docs_sidebar %}
<div class="col-12 col-md-3 bd-sidebar">
{%- include "docs-sidebar.html" %}
</div>
{% endblock %}

{% block docs_toc %}
<div class="d-none d-xl-block col-xl-2 bd-toc">
{% if not (meta is not none and 'notoc' in meta) %}
{%- include "docs-toc.html" %}
{% endif %}
</div>
{% endblock %}

{% block docs_main %}
<main class="col-12 col-md-9 col-xl-7 py-md-5 pl-md-5 pr-md-4 bd-content" role="main">
{% block docs_body %}
<div>
{% block body %} {% endblock %}
</div>
{% endblock %}
{% if theme_show_prev_next %}
<div class='prev-next-bottom'>
{{ prev_next(prev, next) }}
</div>
{% endif %}
</main>
{% endblock %}

<div class="content-container container-fluid" data-spy="scroll" data-target="#bd-toc-nav" data-offset="20">
<div class="container-xl">
<div class="row">
{% block docs_sidebar %}
<div class="col-12 col-md-3 bd-sidebar">
{%- include "docs-sidebar.html" %}
</div>
{% endblock %}

{% block docs_toc %}
<div class="d-none d-xl-block col-xl-2 bd-toc">
{% if not (meta is not none and 'notoc' in meta) %}
{%- include "docs-toc.html" %}
{% endif %}
</div>
{% endblock %}

{% block docs_main %}
<main class="col-12 col-md-9 col-xl-7 py-md-5 pl-md-5 pr-md-4 bd-content" role="main">
{% block docs_body %}
<div>
{% block body %} {% endblock %}
</div>
{% endblock %}
{% if theme_show_prev_next %}
<div class='prev-next-bottom'>
{{ prev_next(prev, next) }}
</div>
{% endif %}
</main>
{% endblock %}

</div>
</div>
</div>

<script src="{{ pathto('_static/js/index.js', 1) }}"></script>
{% if theme_google_analytics_id %}
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', '{{ theme_google_analytics_id }}', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->
{% endif %}

{%- endblock %}
{%- block footer %}
{%- include "footer.html" %}
{%- endblock %}
Copy link
Member

Choose a reason for hiding this comment

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

I suppose the problem here might be that the parent layout (https://github.com/sphinx-doc/sphinx/blob/3.x/sphinx/themes/basic/layout.html) puts this footer block not inside the content block. So that way, it might not be properly overriding the parent footer block.

Not sure how this works exactly with inheritance and blocks (didn't directly see anything about it at https://jinja.palletsprojects.com/en/2.11.x/templates/#template-inheritance)


<script src="{{ pathto('_static/js/index.js', 1) }}"></script>
{% if theme_google_analytics_id %}
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', '{{ theme_google_analytics_id }}', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->
{% endif %}
</div>

{%- block footer %}
{%- include "footer.html" %}
{%- endblock %}
10 changes: 1 addition & 9 deletions src/scss/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body {
font-weight: 400;
line-height: 1.65;
color: #333;
padding-top: 75px;
height: 100vh;
}

p {
Expand Down Expand Up @@ -48,14 +48,6 @@ a {
font-family: 'Open Sans', sans-serif;
font-weight: 400;
line-height: 1.15;

&::before {
// offsetting html anchor titles to adjust for fixed header
display: block;
content: '';
height: 80px;
margin: -80px 0 0;
}
}

h1 {
Expand Down
6 changes: 3 additions & 3 deletions src/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $container-max-widths: (
@import './base';
@import './navbar';

// Custom css, TODO: to be refactored in different partials

.deprecated {
margin-bottom: 10px;
margin-top: 10px;
Expand Down Expand Up @@ -137,7 +137,7 @@ td:first-child {
@supports (position: -webkit-sticky) or (position: sticky) {
position: -webkit-sticky;
position: sticky;
top: 5rem;
top: 0;
height: calc(100vh - 5rem);
overflow-y: auto;
}
Expand Down Expand Up @@ -184,7 +184,7 @@ td:first-child {
@supports (position: -webkit-sticky) or (position: sticky) {
position: -webkit-sticky;
position: sticky;
top: 76px;
top: 0px;
z-index: 1000;
height: calc(100vh - 4rem);
}
Expand Down