Skip to content

Conversation

benjamincharity
Copy link

@benjamincharity benjamincharity commented Mar 2, 2018

doctoc —minheaders X . will only generate a TOC if at least X headings exist

NOTE: 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

Copy link
Collaborator

@PeterDaveHello PeterDaveHello left a 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?

Copy link

@Copilot Copilot AI left a 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;
Copy link
Preview

Copilot AI Nov 20, 2024

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'.

Suggested change
var minHeadersLevel = argv.m || argv.minheaders;
var minHeadersLevel = argv.n || argv.minheaders;

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Only generate ToC if at least X headings are found
2 participants