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

Allow multiple classes for no_toc_section_class #70

Closed
XhmikosR opened this issue Nov 11, 2018 · 12 comments · Fixed by #72
Closed

Allow multiple classes for no_toc_section_class #70

XhmikosR opened this issue Nov 11, 2018 · 12 comments · Fixed by #72

Comments

@XhmikosR
Copy link
Contributor

XhmikosR commented Nov 11, 2018

For example

#### Dealing with specificity

Sometimes contextual classes cannot be applied due to the specificity of another selector. In some cases, a sufficient workaround is to wrap your element's content in a `<div>` with the class.

results in this being included in ToC

https://github.com/twbs/bootstrap/blob/9788baedeadddba9d0bcd4dbaea43d65ece9bcbd/site/_includes/callout.html#L1-L9

Demo: https://twbs-bootstrap4.netlify.com/docs/4.1/utilities/colors/

If I change the header to an h5, since we have max h4, then the header is not included in ToC.

/CC @toshimaru

@XhmikosR
Copy link
Contributor Author

Friendly ping @toshimaru :)

I could replace those headers with a header > 5 but ideally this should be fixed.

@toshimaru
Copy link
Owner

@XhmikosR Hi, I checked your site and I found you configured custom class for no_toc_section.

https://github.com/twbs/bootstrap/blob/9788baedeadddba9d0bcd4dbaea43d65ece9bcbd/_config.yml#L65

You have two options.

  1. Use bd-example class instead of no_toc_section.
  2. Remove your no_toc_section_class configuration, and use no_toc_section.

I think it's not a bug, so I close the issue, but if any further issue, please let me know.

@XhmikosR
Copy link
Contributor Author

@toshimaru How come you think it's not a bug? I already add the no_toc_section in the callout, so I expect any header there to not show up in ToC.

@toshimaru
Copy link
Owner

toshimaru commented Nov 20, 2018

  • Use bd-example class instead of no_toc_section.
  • Remove your no_toc_section_class configuration, and use no_toc_section.

I'd say I already gave options to fix a issue. I'm a not English speaker so if you can't understand the options I gave, could you explain why it doesn't make sense? I could explain the detail more. 👍

@XhmikosR
Copy link
Contributor Author

  1. I can't add bd-example, that's for other uses
  2. Since I can't specify multiple classes there, I'm stuck.

@XhmikosR
Copy link
Contributor Author

OK, maybe I misunderstood the docs. I will try something else and if it works then the docs need to be clarified.

@toshimaru
Copy link
Owner

toshimaru commented Nov 20, 2018

I got it, you'd like to configure multiple no_toc_section classes!! (In your case, no_toc_section and bd-example). Currently, you can configure only one no_toc_section_class.

So, I'd like to propose another option:

  • Remove your no_toc_section_class configuration, which means you can use only no_toc_section class. Then, add no_toc_section to the existing bd-example element.

For exmaple:

<div class="bd-example">

Change it to:

<div class="bd-example no_toc_section">

@XhmikosR
Copy link
Contributor Author

Yeah but that's the problem, we have 133 bd-example instances. Hence why I had suggested from the beginning to allow multiple classes there :)

@toshimaru
Copy link
Owner

Hmm, I originally don't want to allow no_toc_section_class to have multiple values because it might cause the performance decrement, but I've understood your use case.

I change this issue title and re-open it.

@toshimaru toshimaru reopened this Nov 20, 2018
@toshimaru toshimaru changed the title no_toc_section still adds ToC Allow multiple classes for no_toc_section_class Nov 20, 2018
@XhmikosR
Copy link
Contributor Author

I'm not very familiar with Ruby, but it shouldn't have a noticeable performance penalty in theory.

Let me know if you make a beta with this feature.

Thanks!

@toshimaru
Copy link
Owner

toshimaru commented Nov 20, 2018

Yes, you’re probably right, I’m being too sensitive about the performance.

I could implement this without the performance impact, am going to release it in the next version. :)

@toshimaru
Copy link
Owner

@XhmikosR Allowing multiple no_toc_section classes has been released at v0.9.1.

ref. https://github.com/toshimaru/jekyll-toc#skip-toc-section

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 a pull request may close this issue.

2 participants