Add option to enable toc by default#76
Conversation
Also make `toc_only` return nothing when toc is disabled. This might be a more controversial change, but I can't think of a case where outputting two copies of the entire content would be desired.
|
You can configure default value on your defaults:
-
scope:
path: "" # an empty string here means all files in the project
values:
layout: "default"
toc: true # This means toc: true by defaultref. https://jekyllrb.com/docs/configuration/front-matter-defaults/ So, I'd say we don't need to implement it in jekyll-toc itself, please use your own Thanks for sending PR! |
|
Ah, I can't believe I didn't realize that. Thanks :P It's a minor matter, but what is your opinion on making |
This is a good idea. 👍 (I'd say this behavior is a bug 😩 )
Go ahead. :) I think just a one-line change? Line 19 in 6d4a27d |
|
Yep, though again I'm not sure about tests. #77 |
Perhaps it's only me, but I wanted a way to globally enable tables of contents and merely override it on a page-by-page basis. This PR adds an option for that,
enable_by_default.This PR also makes
toc_onlyreturn nothing when toc is disabled. This might bea more controversial change (which perhaps should be in a different PR), but I can't really think of a case where the previous behavior would be desired. I also realize this probably breaks some tests. Unfortunately, when I went to look, a whole bunch of tests seemed to be failing even on master. I recognize that it's a bit poor form to submit a PR without updating the tests, but I'm not too sure what's going on there (plus I'm not familiar with ruby at all).