✨ feat(settings): add hierarchy-based setting overrides #128
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR
Adds hierarchical setting overrides with priority: page > section >config.toml
.Description
This PR introduces a new feature that allows for hierarchical overriding of most settings (see list below). The priority of the settings is evaluated as page > section >
config.toml
.Related issue: #124
Changes
evaluate_setting_priority
, insettings.html
) to handle hierarchical setting logic.config.toml
andtheme.toml
to document the new hierarchy logic for each pertinent setting.katex
,copy_button
, andfootnote_backlinks
frombase.html
tocontent.html
.Priority Table
Here is how the priority is evaluated:
config.toml
Legend:
true
false
Default Settings
The
default
value of the settings which follow this hierarchy is as follows:true
false
false
false
true
true
Example
If you'd like to only show the reading time on posts within your blog section, you could set
config.toml
like:And in your
_index.md
(incontent/blog
):Note: the macro only checks the parent section, not all ancestors.
Additionally, I added some debugging code on top of
content.html
(commented out) to assist in troublehsooting. It creates a table on top of the articles like this:Tasks
markdown.md
andjavascript.md
files to mention the hierarchy where relevant.