This is a repo to test the viability of the possibility of suggesting to the Node.js project that we migrate to the electron/docs-parser for our documentation rather than continuing with our existing tooling.
You will need to clone this repo and install @electron/docs-parser globally:
git clone git@github.com:bnb/node-docs-parser.git
npm i -g @electron/docs-parseryou'll also need to create an (empty) strucutres directory in docs/api/ (just because I've not committed any files to it):
mkdir docs/api/structuresnext, you'll need to navigate to the direcory and then run the CLI:
cd node-docs-parser
npm run parse # this will build the docs!/docs/api/- where the API docs live.
electron-docs-parserlooks here by default.
- where the API docs live.
/docs/api/structures/- required to exist by
electron-docs-parser. Not currently in use but maybe probably should be?
- required to exist by
/originals/- original sources from the Node.js repo for docs in
/docs/api/
- original sources from the Node.js repo for docs in
/electron-api.json- JSON output. Currently somehwat Electron specfici due to hard-coded-ness of the
@electron/docs-parsertool, but there's currently a PR open to make this more dynamic (electron/docs-parser#21).
- JSON output. Currently somehwat Electron specfici due to hard-coded-ness of the
- Several parts of the docs-parser tooling are highly electron-specific electron/docs-parser#19
- Moving as-is, Node.js would seemingly lose the ability to include meta information (
introduced,stability, andhistory)- Having discussed this with Sam from Electron, there are ways we'd be able to address this.
- Currently a bug in which multi-mode outputs incorrect descriptions for additional instances of
Classin the JSON output. electron/docs-parser#17
- Converting
querystringwas relatively straightforward. Effectively just converting the default Node.js format to the docs-parser format. - Converting
v8was significantly more complex. Certain narrative elements of the Node.js docs – or, at least, thev8.mddoc - are fundamentally incompatible with the Electron docs and need to either be re-integrated or dropped entirely.- This isn't necessarily a positive nor a negative - more of a neutral observation. It could be argued that removing certain kinds of one-off narrative elements could bring better overall consistency to the docs, which could be an overall win.
- A more specific example is the
Serialization APIsection of v8.md in the Node.js docs. This section is a narrative seperation that sets apart an API when it should quite likely be sitting at the same level as the rest of the APIs available from the module. TheSerialization APIheading and commentary was axed, moving the commentary into the actual Class definitions themselves. This was necessary because docs-parser expects certain elements (likeInstance Methods) to be at certain levels of heading.
- Converting
worker-threads, I realized how inconsistent several elements of Node.js documentation writing is and how docs-parser forces us into a more consistent folow.- Reading the docs prior to docs-parser, it feels like each bit was writen independently of every other bit, leaving me with a disjointed taste. Using docs-parser, everything becomes uniform and much smoother across sections.
- Despite being even more complex than
v8, this one actually felt significantly more understandable at the end given the restrictions aroundInstance Methods,Instance Properties, andInstance Eventsthat lead to less jittery interactions while reading through the documentation and a more consistent and modular narrative structure. - Enforces a gramatical distinction between methods that
Returnand properties that area/ansomething. While very minor, as a reader this feels very logical and is a helpful distinction.