Repository navigation
Intertwined JavaScript + Markdown Parsing #530
Description
Ref: #402
Ref: #441
Ref: #214
Ref: #287
Ref: #354
The Node.js documentation has become increasingly complex as the contributor-base has grown. Today, due to the diverse number of authors, the documentation is full of little inconsistent formats and structures across documentation files. Parsing these varied formats (especially lists) has proven to be quite the challenge.
However, if we integrate JSDoc parsing with markdown parsing, we can leverage JSDoc for metadata, parameter typings, and function signatures. The Markdown docs would be mostly reserved for free-form documentation + YAML metadata.
In the event a function does not have the proper JSDoc, we fall back to the Markdown (since, if this is even something we consider, it'll take a while to add JSDoc to core)
Given the following inputs:
### `fs.mkdirSync` <!-- Note: The header here has no parameters, as those are populated from the signatures -->
<!-- YAML
added: v0.1.21
changes:
- ...
-->
Description... /**
* @param {string|Buffer|URL} path The file path
*/
function mkdirSync(path) {
...
}The parser/generator will be able to generate metadata with all the signatures, parameters, and their appropriate descriptions.
In a case where a sub-list is needed, using - to indicate a list item in the JSDoc can be used.
/**
* @param {"one"|"two"|"three"} mode The operation mode:
* - "one": do X
* - "two": do Y
* - "three": do Z
**/In a case where a function has multiple unique signatures, the @overload property can be used:
/**
* @overload
* @param {string} path
* @param {Object} options
* @returns {string}
*
* @overload
* @param {Buffer} path
* @returns {undefined}
*/Each overload will generate a unique header, but only one header should exist in the markdown file.
This'll tie in well to #441, since the types used in JSDoc will be valid TypeScript types, making it extremely easy for consumers. Additionally, it follows the similar format used in the json generator prototype (#287), as that follows JSDoc syntax.
Obviously, this is a long-term goal, and not something that we can achieve until after the new tooling lands, and core is properly typed (and that's a huge undertaking within itself)
How we would implement this
Currently, we are in "Phase 1":
- Legacy tooling generating a legacy page from legacy markdown
- New tooling generating a legacy page from legacy markdown
- New tooling generating a new page from legacy markdown
- New tooling generating a new page from new markdown ("new" being the intertwined version)
- JSDoc needs to be implemented throughout core
- A new generator chain
[*.js, *.md] -> intertwined-metadataneeds to be created - The
jsx-astgenerator needs to be updated to accept this new metadata format
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
Renegade334 commentedon Dec 24, 2025
This assumes that the JSDoc that exists is (or could become) as at least as robust, or more so, than the Markdown. Ultimately, the human element is still the weak link: it relies on the input to the tooling being accurate, and with the added complexity for contributors, I'm not sure how sustainable this would end up being.
It's also non-trivial to actually resolve a lot of final API exports to their root definition in the source, since a lot are internal re-exports, lazy-loaded, or defined using Object.defineProperty.
avivkeller commentedon Dec 24, 2025
True, but ideally, we'd use something like VSCode's IntelliSense, which resolves the source, parses the JSDoc, etc.
avivkeller commentedon Jan 15, 2026
As noted on Slack, core could probably TypeScript declaration files, which would also achieve this goal.
avivkeller commentedon Feb 3, 2026
@JakobJingleheimer What's the status of adding
d.tsfiles to node core?JakobJingleheimer commentedon Feb 3, 2026
I synced with René and have a plan forward. It's next on my list.
avivkeller commentedon Feb 3, 2026
Awesome! Let me know how I can help! I'll work on preparing parsing for this in the mean time.
JakobJingleheimer commentedon Feb 3, 2026
I certainly shall! I'll ping you once I have something to show—it'll be a helluva lift (would rather not do all myself 🫠).
Wshao777 commentedon Jun 28, 2026
Wshao777 commentedon Jun 28, 2026
Wshao777 commentedon Jun 28, 2026