typedoc icon indicating copy to clipboard operation
typedoc copied to clipboard

Generate documentation from JSON output

Open jonsage opened this issue 5 years ago • 6 comments

JSON file could also be used as the input for Typedoc

Typedoc can output a JSON file containing all the reflection data instead of creating the HTML (or other format) documentation. It would good if this JSON file could also be used as the input for Typedoc and the HTML (or other format) documentation generated from that JSON.

Problem

I work with a documentation portal, and I do not have access to the TypeScript code itself, just the exported reflection data (JSON). I'd like to process this into documentation and manage the templates/theming within my side of things.

Suggested Solution

Allow Typedoc JSON format refelection data to be used as input for the Typedoc tool.

jonsage avatar Jan 16 '20 21:01 jonsage

This would be a neat bit of functionality to support. I think we should eventually be able to do this... it's a ways off though. Some information in the reflections isn't reflected in the JSON output. (Mainly cross references, I think all the type information is present)

Gerrit0 avatar Jan 17 '20 00:01 Gerrit0

Some information in the reflections isn't reflected in the JSON output.

Can you expound on this @Gerrit0? I was planning on using the JSON output to build a simple markdown doc for some internal Typescript libraries we use.

raygesualdo avatar Feb 03 '21 00:02 raygesualdo

I think with 0.20 we're a lot closer to being able to do this in TypeDoc itself. Missing items I can think of initially:

  • files / directories on ProjectReflection - I want to remove these anyways. We build them up but don't really use it for anything, and AFAIK no plugin does either.
  • url, anchor, hasOwnDocument, cssClasses on Reflection - these are all inappropriately placed anyways, they shouldn't live on the reflections.

... and that's all I can think of right now, which means this is actually a lot closer to being possible than I thought it was. It might be one of the goals of 0.22 since 0.21 is going to clean up both of these.

This shouldn't stop you from using the JSON output today. This request is for TypeDoc being able to be re-run on JSON produced from a prior run. It's certainly possible to generate docs with a different tool from the json already.

Gerrit0 avatar Feb 03 '21 02:02 Gerrit0

Thanks for the clarification!

raygesualdo avatar Feb 03 '21 05:02 raygesualdo

This would be a killer feature.

jankuca avatar Mar 04 '21 16:03 jankuca

TypeDoc sites look amazing too, the way I see it, this feature could see TypeDoc site used in other typed languages (as long as they can convert the AST type data to JSON)

sancarn avatar Sep 07 '22 13:09 sancarn

Now using Typedoc, can we generate documentation in HTML format using JSON output?

divya-gariga avatar Feb 20 '23 11:02 divya-gariga

v0.24.0 has released with support for this, the relevant option is --entryPointStrategy merge, which can take multiple previously created JSON output files and generate documentation from them.

Gerrit0 avatar Apr 08 '23 22:04 Gerrit0

Nice

Dayday10 avatar Apr 08 '23 23:04 Dayday10