Post

Thank you!! Lots of fun directions we can take this, and I'm sure I missed some edge cases. Real heavy lifting here and shoutout goes to the @deno.land folks for providing the underlying tooling. All I did was a little glue code really.

great to see deno_doc being used! how are you using it exactly? are you using the actual html renderer and modifying the output, `generateHtmlAsJSON`, or raw doc nodes?

pretty naively in this first pass! i'm basically: 1. fetching type urls from esh.sh with an `x-typescript-types` header 2. run it `@deno/doc` slightly patched to get WASM to work on a vercel function 3. take the `DenoDocNode[]` structured AST result 4. flatten, transform, merge, render to HTML

skipping over the details a bit, and there are still some rough edges (especially for complex packages with sprawling entrypoint graphs) but works surprisingly well!

0 reposts1 like

I didn't see `generateHTMLasJSON` but that might be easier than what I'm doing if it does what it sounds like. though we're preprocessing the shiki highlighting server side here too, so maybe the raw doc nodes are more flexible for this use case

yeah raw doc nodes are definitely more flexible, but the amount of edge cases to cover is way more than one might think, still to this day i am fixing edgecases around using raw doc nodes.

generateHTMLasJSON (as terribly named as it is), is probably your best bet. it handles references between symbols, grouping of nodes, and many more things (and basically the point of it is handling docnodes edgecases).