Closed ovflowd closed 3 months ago
cc @nodejs/collaborators and @nodejs/documentation as this PR changes a few aspects on the generated HTML as mentioned above.
Dropped support of
all.html
Can this be avoided?
Dropped support of
all.html
Can this be avoided?
Is there any concrete reason why? Afaik, nothing officially gets referenced to all.html. We can still write an all.json, tho,
But yes, if this is a blocker, I can do it differently, but I'm just wondering if we could avoid an all.html as that would add some extra complexity. (and running time of the tooling, as pretty much we're going through everything twice)
Well I'm using it a lot (to CTRL+F because we don't have a good docs search feature), so I expect it to be the case for other people. This is a disruptive change that I would not like to see before the docs redesign.
Well I'm using it a lot (to CTRL+F because we don't have a good docs search feature), so I expect it to be the case for other people. This is a disruptive change that I would not like to see before the docs redesign.
Gotcha, yes, the docs redesign aims to solve this. To be honest, the https://nodejs.org search box already includes all the API data, and it is continuously updated. (Also, the search box API data indexing will be done on the nodejs.org repository, so technically, it is decoupled from the actual API docs, or at least so it will be for the initial implementation.
For local dev environments, I believe it can source the results locally, but I'm not sure if they will match since Orama (our search provider) has some extra processing on their cloud.
I understand this is a pain point, but I do feel hesitant on an all.html, but I believe I can make it happen.
To be honest, the https://nodejs.org/ search box already includes all the API data
It only works for the latest LTS version (AFAIK)
To be honest, the nodejs.org search box already includes all the API data
It only works for the latest LTS version (AFAIK)
Correct, it indexes the LTS version. That's a good point. @micheleriva, what are the alternatives here? Can we make it for API doc generation so the whole database can be built locally based on metadata we ingest? i.e., is it a static database stored in a static file and loaded by the Orama client during bootstrap (client side)
@targos I've added a legacy-html-all
generator which extends on the legacy-html
generator for generating the API docs + all.html
cc @nodejs/web-infra, can we have a 2nd thorough review and verify that the pages match?
I still need to update the code that generates the CodeBoxes and the Stability overview. I'll do that later tomorrow or today.
Correct, it indexes the LTS version. That's a good point. @micheleriva, what are the alternatives here? Can we make it for API doc generation so the whole database can be built locally based on metadata we ingest? i.e., is it a static database stored in a static file and loaded by the Orama client during bootstrap (client side)
@ovflowd sorry for my late reply. Yes, we can definitely do this. Let me just point out that the search results may slightly differ from Orama Cloud (more performant, more accurate results) and Orama OSS. I hope that's not a dealbreaker.
Correct, it indexes the LTS version. That's a good point. @micheleriva, what are the alternatives here? Can we make it for API doc generation so the whole database can be built locally based on metadata we ingest? i.e., is it a static database stored in a static file and loaded by the Orama client during bootstrap (client side)
@ovflowd sorry for my late reply. Yes, we can definitely do this. Let me just point out that the search results may slightly differ from Orama Cloud (more performant, more accurate results) and Orama OSS. I hope that's not a dealbreaker.
I think that's a fair trade-off, at least within directly the Node.js API docs pages. Are there docs out there on how we can use this?
I think that's a fair trade-off, at least within directly the Node.js API docs pages. Are there docs out there on how we can use this?
We have our docs at https://docs.orama.com/open-source, and you would probably need to use that plugin: https://docs.orama.com/open-source/plugins/plugin-data-persistence.
We can give you support probably starting next week or so to write down a reference architecture/implementation π
This PR is quite massive (would it have been possible/feasible to break this upβat least smaller chunks into a feature branch that was then wholesale merged?),
I think I could move the bug fixes to a different branch, yes, and the unrelated changes. I'll do this when this branch is feature-complete. Although the PR is open, I believe it should be a draft PR.
I think that's a fair trade-off, at least within directly the Node.js API docs pages. Are there docs out there on how we can use this?
We have our docs at docs.orama.com/open-source, and you would probably need to use that plugin: docs.orama.com/open-source/plugins/plugin-data-persistence.
We can give you support probably starting next week or so to write down a reference architecture/implementation π
Awesome! cc @canerakdas or @AugustinMauroy can any of you open an issue to keep track of the search box work for this repo? For all's worth, it should be another generator to generate the Orama local database.
The search component itself would be either the same from the Node.js website or on the react generator here in the future; Butb the database generation should be a generator.
I've rebased the branch and am going to keep working on the features.
@AugustinMauroy tests are failing, I assume because I changed the way how stability indexes are built. Can you look into it?
cc @nodejs/web-infra another review please π I changed the HTML creation to be mostly
FYI: After the next review, I once again will need to decouple changes. Apologies for the prolonged review, implementing this is time consuming, and I want to ensure things work as expected.
FYI @nodejs/web-infra I split the changes: https://github.com/nodejs/api-docs-tooling/pull/66, waiting for review to getting it merged back here.
Alrighty, I believe we are very close to have this generator done. I believe this PR is pretty much ready to be reviewed, since the last missing piece is having the CJS/ESM toggles, which I'm going to do soon whenever I have time :)
cc @nodejs/web-infra please add another round of reviews π
@ovflowd I compared the output of the legacy HTML generator with the current version for a few pages, not sure if some of them need fixing π
Jump links don't exist/work
There are changes in the name on the left menu. For example;
- Assertion testing
+ Assert
- C/C++ addons with Node-API
+ Node-API
- Child processes
+ Child Process
There are differences in the listing in the left menu; hr
should be after "Usage and example."
The sequential links on the /errors
page do not seem to be generated correctly;
This issue is likely related to the above, but there are also problems with the type references on the following pages:
/url
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [`<string>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><Object></a>
/os
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) (in MHz" class="type"><number></a>
This issue also appears on other pages
Except for these minor issues, it looks content-wise 1-1 identical to the current pages β¨
- There are changes in the name on the left menu. For example;
- Assertion testing + Assert - C/C++ addons with Node-API + Node-API - Child processes + Child Process
- There are differences in the listing in the left menu;
hr
should be after "Usage and example."
Have you read the PR description? π -- navigation generation is done automatically from now on, instead from reading the manually defined navigation file that exists on /doc/api :P, so yes, it will be different, and that's intentional.
Jump links don't exist/work
What are jump links?
- The sequential links on the
/errors
page do not seem to be generated correctly;This issue is likely related to the above, but there are also problems with the type references on the following pages:
/url
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [`<string>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><Object></a>
/os
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) (in MHz" class="type"><number></a>
This issue also appears on other pages
Except for these minor issues, it looks content-wise 1-1 identical to the current pages β¨
Fixed! Thanks for noticing it!
Jump links don't exist/work
What are jump links?
Anchors with a unique id located to the right of the headings;
Jump links don't exist/work
What are jump links?
Anchors with a unique id located to the right of the headings;
Oh they were working before π€
cc @nodejs/collaborators @nodejs/build this PR is finally ready, and all the features from the current legacy API docs template are built-in here.
Please, if possible test/run locally and check if the templates, and API docs look in a way y'all are satisfied with :)
cc @nodejs/web-infra for a final code review π
More than the code, I'd like to review the output. Is there a preview somewhere or do I have to build it locally?
Unfortunately need to build locally. I'm not sure where I could upload a preview here. I recall you had a Netlify account or something? If you build you can simply upload the out/ folder
(Im not sure if I can deploy static files to Vercel)
Do we have a good input file that we can test with?
Do we have a good input file that we can test with?
If you want to generate against all docs:
node bin/cli.mjs -i "/path/to/node/doc/api/*.md" -o /tmp/out -t legacy-html-all
@targos here's a deploy using Node v22.7.0 as a binary and targeting this commit from nodejs/node
for the doc files: https://node-api-docs-legacy-preview.netlify.app/
Little inconsistency with the index page's title (above is the new version):
View on a single page option is missing (screenshot is from current docs), although the all.html
page exists:
Every method has a "History" table always
I don't like that, because it seems that the history falls back to "Introduced in: v0.10.0", which is probably wrong in most cases.
Every method has a "History" table always
I don't like that, because it seems that the history falls back to "Introduced in: v0.10.0", which is probably wrong in most cases.
Could you give examples?
FYI @targos I've made a redeploy with a hot fix regarding the CJS/MJS pre elements.
Is it possible to have a light theme for code blocks when the page is in light mode?
Current:
New:
Little inconsistency with the index page's title (above is the new version):
Fixed
View on a single page option is missing (screenshot is from current docs), although the
all.html
page exists:
Fixed
Is it possible to have a light theme for code blocks when the page is in light mode?
Current:
New:
I could check on Shiki docs. I believe they have support for dark/light theme modes.
Fixes deployed on https://node-api-docs-legacy-preview.netlify.app/
Sidebar Navigation is generated on-demand instead of relying on nodejs/node/doc/api/index.md This means some of the entries are a bit different, although I believe they are fine.
I think that's fine (IIUC we can update the page headings to change the navigation text), except: Now "Usage and example" is sorted with the other API docs pages, which doesn't make sense. I guess we're also lucky that "About" is sorted first ^^
Consequence of the light mode issue:
Sidebar Navigation is generated on-demand instead of relying on nodejs/node/doc/api/index.md This means some of the entries are a bit different, although I believe they are fine.
I think that's fine (IIUC we can update the page headings to change the navigation text), except: Now "Usage and example" is sorted with the other API docs pages, which doesn't make sense. I guess we're also lucky that "About" is sorted first ^^
Correct. Although, the reasoning behind this change is to not depend on the existence of an index.md to source from -- this tooling tries to be agnostic as much as possible.
In the future, with the new generator (redesign of API docs) the sidebar will be grouped by module type (Module, Class, Globals, etc) as it was for a short while on https://nodejs.dev
Now "Usage and example" is sorted with the other API docs pages, which doesn't make sense.
Agreed. Although the synopsis page never made sense to me, and even less now with the Node.js Website Learn section. I think that page could be removed IMO.
Every method has a "History" table always
I don't like that, because it seems that the history falls back to "Introduced in: v0.10.0", which is probably wrong in most cases.
Could you give examples?
Forget it, it's actually part of the markdown source code. I just happened to click on three pages that had the same version by chance.
Is it possible to have a light theme for code blocks when the page is in light mode? Current: New:
I could check on Shiki docs. I believe they have support for dark/light theme modes.
Fixed.
Consequence of the light mode issue:
Fixed.
Re-deployed on same URL with Codebox fixes. (Including some margin between CJS and Copy Button)
Description
This PR introduces the Legacy HTML generator, which aims to generate an almost 1:1 replica of the existing https://nodejs.org/api/ documentation.
This PR introduces the fully-fledged
legacy-HTML
generator, with all the related utilities and tools to make complete API docs in HTML.Diversions from the original version:
nodejs/node/doc/api/index.md
Things to be done:
None. We're feature complete!
Future generators
json
generator, being able to generate.json
files for API docsreact
generator, the redesign of API docs generator.Validation
Clone, run
npm install
, then run the command against Node.js API docs, for example:You can just open the desired files on your browser.
Preview
This is deployed temporarily on Netlify (not auto deployed on commits, I'm manually deploying it): https://node-api-docs-legacy-preview.netlify.app/
Related Issues
Closes https://github.com/nodejs/api-docs-tooling/issues/15