Skip to content

Page Contributors shows as sub-heading in ToC #1148

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
rkoeninger opened this issue Sep 18, 2018 · 2 comments
Closed

Page Contributors shows as sub-heading in ToC #1148

rkoeninger opened this issue Sep 18, 2018 · 2 comments

Comments

@rkoeninger
Copy link
Contributor

Just noticed something weird about how the table of contents is structured.

The generated "Contributors to this Page" section at the bottom of each page gets shown as a sub-heading in the ToC when it logically isn't:

(Contributors is not a sub-section of Structural Types)

image

Two quick ways of fixing it:

  1. Adding .content-contributors in the exclude list when calling the toc plugin, so it doesn't show up in the ToC, see here:

// TOC:
$(document).ready(function() {
if ($("#sidebar-toc").length) {
$('#toc').toc({
exclude: 'h1, h5, h6',
context: '.inner-box',
autoId: true,
numerate: false
});
toggleStickyToc();
}
})

  1. Or make the contributors heading an h2 so it's on the same level as the previous heading and won't get nested under it:

<div class="content-contributors">
<h3>Contributors to this page:</h3>
<div id="contributors" class="contributors-container"></div>
</div>

We can decide the preferred approach and I'll open a PR with the fix.

@SethTisue
Copy link
Member

I don't have an opinion either way... anybody else?

@rkoeninger
Copy link
Contributor Author

rkoeninger commented Sep 24, 2018

I instead tried option 3, which is to have the .toc function target an ad-hoc toc-context class instead of the incidental inner-box. Divs that contain information you want to show in the TOC would now have toc-context added to their class list. If the content you want on the TOC has sibling content that you don't want on the TOC, move the TOC-targeted content into a nested div with class="toc-context". e.g.

<div class="inner-box">
  <div class="toc-context">
    {{content}}
  </div>

  {% include contributors-list.html %}
</div>

and

<div class="inner-box toc-context">
  {{content}}
</div>

Started working on a PR for this.

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

No branches or pull requests

2 participants