-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Generate header ids for each level #6544
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
when generating slugs for each heading in the markdown file, the script has some issue for level 3 to 6. Fixes: ethereum#6529
the base level of heading is 3 and we add a heading level if needed. we prevent going to the 6th level when it is not needed Refs: ethereum#6529
Gatsby Cloud Build Reportethereum-org-website-dev 🎉 Your build was successful! See the Deploy preview here. Build Details🕐 Build time: 30m PerformanceLighthouse report
|
| # Active areas of Ethereum research {#active-areas-of-ethereum-research} | ||
|
|
||
| One of the primary strengths of Ethereum is that an active research and engineering community are constantly improving it. Many enthusiastic, skilled people worldwide would like to apply themselves to outstanding issues in Ethereum, but it is not always easy to find out what those issues are. This page outlines key active research areas as a rough guide to Ethereum's cutting edge. | ||
| One of the primary strengths of Ethereum is that it is constantly being improved by an active research and engineering community. There are many enthusiastic, skilled people worldwide that would like to apply themselves to outstanding issues in Ethereum, but it is not always easy to find out what those issues are. This page aims to outline key areas of active research as a rough guide to Ethereum's cutting edge. |
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.
Not sure why these copy changes are in here - perhaps the file is outdated? Could you please sync this up with latest in dev branch, then re-apply the header ids?
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.
By the time, I took the file from the example you gave. #6527 :)
Header ids will be applied as requested.
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.
Ah, gotcha. Makes sense. Always worth ensuring your files are up to date with the latest dev when you open a PR 👍
Thanks for fixing!
| # Active areas of Ethereum research {#active-areas-of-ethereum-research} | ||
|
|
||
| One of the primary strengths of Ethereum is that an active research and engineering community are constantly improving it. Many enthusiastic, skilled people worldwide would like to apply themselves to outstanding issues in Ethereum, but it is not always easy to find out what those issues are. This page outlines key active research areas as a rough guide to Ethereum's cutting edge. | ||
| One of the primary strengths of Ethereum is that it is constantly being improved by an active research and engineering community. There are many enthusiastic, skilled people worldwide that would like to apply themselves to outstanding issues in Ethereum, but it is not always easy to find out what those issues are. This page aims to outline key areas of active research as a rough guide to Ethereum's cutting edge. |
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.
Not sure why these copy changes are in here - perhaps the file is outdated? Could you please sync this up with latest in dev branch, then re-apply the header ids?
src/scripts/generate-heading-ids.js
Outdated
|
|
||
| const headingLevelArrayIndex = headingLevel.length - 1 | ||
| if ( | ||
| curLevel[headingLevelArrayIndex] == undefined || |
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.
May be able to simplify this statement by just checking if it's a truthy value or not, i.e.
if (!curLevel[headingLevelArrayIndex]) {
curLevel[headingLevelArrayIndex] = 0
}
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.
Of course it's better 👍🏽
src/scripts/generate-heading-ids.js
Outdated
| ) { | ||
| curLevel[headingLevelArrayIndex] = 0 | ||
| } | ||
| curLevel[headingLevel.length - 1]++ |
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.
| curLevel[headingLevel.length - 1]++ | |
| curLevel[headingLevelArrayIndex]++ |
Should we use headingLevelArrayIndex her now that variable exists?
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.
Indeed we should
samajammin
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.
Awesome, thanks for the PR! Code mostly looks good & I tested the script locally on a file - looks to work 👍👍
Left a couple suggestions on the script. Also see my comment re: the markdown file content - I don't think we should actually be changing any content as part of this PR.
merge upstream dev
the script check against potential undefined value of the array of heading level. The if/else statement is overkill and can be simplified
samajammin
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.
Amazing - thanks for the updates! 🎉
Description
The generate-heading-ids script does not go deeper than h3s. In md, the max level of heading is 6.
But the fixed version of the script will check the maximum level and generate the header number without useless 0s for heading level not used.
Related Issue
Related to generate-heading-ids script is a bit broken #6529