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

Add an ignore_within option #53

Merged
merged 1 commit into from
Oct 9, 2018
Merged

Conversation

DEfusion
Copy link
Contributor

Adds an ignore_within option to provide a selector to ignore elements within. So given the following HTML:

<h1>h1</h1>
<div class="exclude">
  <h2>h2</h2>
  <h3>h3</h3>
</div>
<h4>h4</h4>

With the configuration:

toc:
  ignore_within: .exclude

All headings within the .exclude selector will be ignored.

@toshimaru
Copy link
Owner

@DEfusion Thanks for sending PR 😍

In the version v0.7.0.alpha1, no_toc feature is released. What about using no_toc class to ignore the toc-headings instead of this ignore_within feature??

@DEfusion
Copy link
Contributor Author

DEfusion commented Sep 28, 2018

The no_toc class isn't ideal for my use case where I'm documenting a CSS framework so want to exclude everything within the examples, for instance:

<h2>Titles</h2>
<div class="example">
   <h1 class="title">Title</h1>
   <h2 class="subtitle">Subtitle</h2>
</div>

<h2>Sections</h2>
<div class="example">
   <div class="section">
      <h1 class="title">Title</h1>
      ...
   </div>
</div>

So I'd rather automatically exclude all headings from the toc rather than having to add the no_toc class to each heading within the examples so as to keep the documentation clear regarding the framework HTML & class names.

@toshimaru toshimaru self-assigned this Sep 30, 2018
@toshimaru toshimaru self-requested a review October 7, 2018 04:23
@toshimaru
Copy link
Owner

@DEfusion That makes sense, having ignore section would be useful.

Could you rebase the PR to fix conflict?

Copy link
Owner

@toshimaru toshimaru left a comment

Choose a reason for hiding this comment

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

Fixing conflict is needed 💥

Adds an `ignore_within` option to provide a selector to ignore elements within. So given the following HTML:

```html
<h1>h1</h1>
<div class="exclude">
  <h2>h2</h2>
  <h3>h3</h3>
</div>
<h4>h4</h4>
```

With the configuration:
```yml
toc:
  ignore_within: .exclude
```

All headings within the `.exclude` selector will be ignored.
@DEfusion
Copy link
Contributor Author

DEfusion commented Oct 8, 2018

@toshimaru rebased, no conflicts now.

@toshimaru
Copy link
Owner

@DEfusion Thanks, let's get this merged.

@toshimaru toshimaru merged commit 933ebdf into toshimaru:master Oct 9, 2018
@toshimaru
Copy link
Owner

toshimaru commented Oct 9, 2018

v0.8.0.beta1 released. :)

N7K4 pushed a commit to n13org/jekyll-toc-navtotop that referenced this pull request Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants