-
-
Notifications
You must be signed in to change notification settings - Fork 479
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
feat: now supports minheaders flag #142
base: master
Are you sure you want to change the base?
Conversation
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.
Is it possible that we can get some help from the latest LLM models to add some tests for it?
Copilot
AI
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.
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 suggestion.
Comments skipped due to low confidence (2)
lib/transform.js:117
- [nitpick] The variable name minHeadersLevelHtml is inconsistent with the parameter name minHeadersLevel. It should be renamed to minHeadersLevel.
var minHeadersLevelHtml = minHeadersLevel || 0;
lib/transform.js:138
- [nitpick] The variable name minHeadersLevelHtml is inconsistent with the parameter name minHeadersLevel. It should be renamed to minHeadersLevel.
var lessHeadersThanMin = linkedHeaders.length < minHeadersLevelHtml;
@@ -98,6 +98,9 @@ var stdOut = argv.s || argv.stdout | |||
var maxHeaderLevel = argv.m || argv.maxlevel; | |||
if (maxHeaderLevel && isNaN(maxHeaderLevel) || maxHeaderLevel < 0) { console.error('Max. heading level specified is not a positive number: ' + maxHeaderLevel), printUsageAndExit(true); } | |||
|
|||
var minHeadersLevel = argv.m || argv.minheaders; |
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.
The variable 'minHeadersLevel' is assigned using 'argv.m', which is already used for 'maxHeaderLevel'. This could lead to unexpected behavior. Consider using a different variable for 'minHeadersLevel'.
var minHeadersLevel = argv.m || argv.minheaders; | |
var minHeadersLevel = argv.n || argv.minheaders; |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
doctoc —minheaders X .
will only generate a TOC if at least X headings existNOTE: Functionally this is complete; but I have not yet added tests. I am not very familiar with this testing format and one test already seems to be failing (prior to my change). Any help/direction here would be appreciated! 🙏
Closes: #141