Skip to content
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

fix: don't assume heading type is module #140

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RedYetiDev
Copy link
Member

Description

According to the legacy parser:
https://github.com/nodejs/node/blob/0a00217a5f67ef4a22384cfc80eb6dd9a917fdc1/tools/doc/json.mjs#L478-L489

As shown above, the heading should not have a default value. The generators should decide whether a misc or module heading is appropiate based on the heading of the parent.

Validation

See updated tests

Related Issues

#139

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I've covered new added functionality with unit tests if necessary.

@RedYetiDev RedYetiDev requested a review from a team as a code owner November 9, 2024 18:40
@@ -130,5 +130,5 @@ export const parseHeadingIntoMetadata = (heading, depth) => {
}
}

return { text: heading, type: 'module', name: heading, depth };
return { text: heading, name: heading, depth };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this leads to headings without any type :)

Would suggest running a diff of the json of main and this branch.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, but IMO that's the correct behavior, as we can't be certain the type is module, it could be misc, therefore, the type is empty.

I could also not do this change, and have it overwrite the module with misc when needed (I.E. json-legacy).

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.

3 participants