-
Notifications
You must be signed in to change notification settings - Fork 9
Explicitly number the sections of the charter. #34
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
Conversation
…he Storage standard as one of its destinations.
charter.html
Outdated
| if (elementWithID instanceof HTMLHeadingElement) { | ||
| const headingLevel = parseInt(elementWithID.localName.substring(1), 10); | ||
| sectionCounters[headingLevel]++; | ||
| for (let i = headingLevel+1; i < 7; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider replacing lines 700 through 706 with:
sectionCounters.fill(0, headingLevel + 1);
let sectionNumber = sectionCounters.slice(0, headingLevel + 1).filter(item=> item != 0);
The slice call is actually not necessary but may make the intent more clear to the reader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
erik-anderson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. The change suggested in my comment is optional.
martinthomson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we shouldn't merge this? With Erik's tweak, this seems pretty useful to me.
| let sectionCounters = [NaN, 0, 0, 0, 0, 0, 0]; | ||
| document.querySelectorAll("[id]").forEach(function(elementWithID) { | ||
| const permalink = document.createElement("a"); | ||
| permalink.href = "#" + elementWithID.getAttribute("id"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize that this has been sitting here awhile, but maybe this could be made absolute by starting with document.querySelector("#about+ul li a").href (or a simpler query if you tag that element more directly, as I think we should). Then the permalink is much closer to perma.
This doesn't contain any normative or functional changes, merely aesthetic ones.