To make it very clear, Dockit is not like the future of just Node.js API tuning. It is also something we are releasing to the community as like a sort of DocuSource that allows the community to also generate their own API docs. And I'm going to talk a little bit more about that in the following slides. As I mentioned, we created a specification which you can read from this QR code. It was like handfully crafted by Aviv Keller, one of our contributors. And that is, as I mentioned, is a super set of common mark and has pretty much everything that we believe that specification is to have to create awesome API docs, be them like, you know, something that the user is reading in the end or just like the source markdown. I call everyone that is watching this talk, if you're interested in this, I think it's pretty cool specification to read.
So how we built it. So as I mentioned, all the tools we used, Regaxis, pretty much to identify the structure of the document. Right now we're using AST, powered by the Unified Ecosystem to pretty much read markdown, JS doc, TS doc, and be able to parse all the different elements and hieroglyphics and headings and whatever text is within the markdown to generate AST that will be able to separate what is a heading, what is a type definition, what are slugs, what is like an instability label. Like if this specific class is duplicated or stable or in the development, also from the YAML metadata, cross references, like being able to move information from MDN, etc. It is a very cool engine that took a lot of time and a lot of effort to make because we want to ensure that it stays performant and it can pretty much understand as abstract as possible that syntax tree and follow the specification that we've done. The code is very well documented and again, I always encourage you to look at the source code of Docket if you're interested.
The way how it also works is with a generator system, think of the plugin system, the generators are what generate, take an input and generate an output, and within the pipeline, for example, in order for you to see what are right now the HTML pages, you have at least five steps from the initial ASU process, collecting the metadata, just for me into JSX, then going through a react and react with the components to then the final HTML that is 100% server side also. For example, in this tab you had five different generators. The generator system allows you to pretty much hook into the source and pretty much create anything off from it, generate anything out from it. The cool technical side behind it is the way how it is designed is that the different generators, even though they're sequential, imagine that web is the result that you saw on the previous lines of the redesign page and ASC is the source and the way how they're designed is that they pretty much work in a yielding chunking process that as long as the first previous part of the pipeline has anything already ready, it will forward to the next generator, which allows you to work in a parallel based system and also chunk the information. This is very critical because the larger your API docs are, the more markdown pages you have, the more source you have, the larger your AST is going to be and the more you want to benefit from multithreading, chunking and all the amazing parallelism features from node.js. So Dockit unironically uses the best features that you have in node.js to create node API docs. And as I mentioned, this is not just for node, the specification is open and right now we are already using Dockit as early adopters within Webpack to generate the next generation version of Webpack API docs. We have a project within Google Surmerge Code that aims to also have students working on it and improving Dockit and we are also using it across different repositories within node, not just anymore with the API docs, but also the learn materials that we have on node.js.org slash learn. And cool thing is that Dockit is being used right now within node.js.org slash API.
Comments