-
Notifications
You must be signed in to change notification settings - Fork 315
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
Table of Contents Snippet exclusion system #3261
base: master
Are you sure you want to change the base?
Conversation
either I am building the lookup incorrectly or Chrome is not letting me see variables via computedStyles.
This js works: var iframe = document.getElementById('BrewRenderer');
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
var headings = iframeDocument.querySelectorAll('h1, h2, h3, h4, h5, h6');
headings.forEach(function (heading) {
let text = heading.innerText;
let page = heading.closest('.page,.phb').id;
let excluded = getComputedStyle(heading).getPropertyValue("--TOC");
console.log({page, text, excluded});
// add to the snippet output
} |
@ericscheid, @5e-Cleric , @Gazook89 , @G-Ambatte Is the current behavior acceptable to you? Default exclusions with manual inclusion and exclusion tags via CSS? If the behavior is agreed upon I will just check over for code quality and bugs. |
|
The snippet js starts with the assumption of The use of exclusion rules is short and simple to modify and covers the desired exclusions (h3 and h4 inside .monster, various cover pages, h5, h6). There's an argument for also excluding The philosophy of using inclusion tags (i.e. assert via manually editing brew.text in all the curly-blocks) is fraught with tedium. There is a usecase for a generic |
My guess would be |
Clear out manual toggles.
…ry-broken into issue_2994_css_style
This particular implementation has no inclusions for .monster based on the described problem. Should this be revised to include h1 and h2 as it does now? I think since this impacts a snippet it is far more permissible to behave differently. |
Two more things to tweak:
becomes:
This PR has changed H3's to appear as I don't think there is any defined behavior for what an H4-H6 should look like in the ToC, but they shouldn't be "bigger" than an H3, which is plain text. Perhaps after H3 just continue indenting for H4-H6 with no further styling change. Perhaps for a future PR, we may want to look at some of the consequences of a |
This fixes an error in the recusion that was failing to add children under existing parents. Index generation now does not overindent when levels are skipped. PartCover less code as suggesred by CC.
…ry-broken into issue_2994_css_style
Not sure if this has been talked, is the type of element in the ToC set via the type of header it references, or by the position in the ToC? i have an h1 followed by h3, and the h3 gets the same styling as an h2 would. |
This was a side effect of the "over-indention protection. The current code ties the level of indention to whether or not there is H-styling on the entry. If this is not desired ( An H1 followed by an H6 ) adjustments will need to be made. |
By the position. |
Based on @ericscheid's suggestion.
This modifies the Table of Contents snippet to ignore headers that have an active CSS variable
--TOC
with a value of exclude. To facilitate backward compatibility, CSS classes have been added or altered to have this value set along with themonster
class in the 5ePHB theme. Additional classes have been added for toggling on and off exclusions.To Be Determined:
Which of this CSS work should relocate to the Blank class.