Discussion: intermediate output format #1420
Description
This is a discussion thread. Please correct me where I'm wrong. It's just to put down a big feature idea I've been thinking of for some time in one place, and maybe one day we could move towards this.
Haddock currently has three-or-so output formats. The central format is html. There's some latex rendering, but I imagine it is quite bitrotted. There is hoogle output, which is maintained just enough to be usable, but is not very good. And finally there's an "interface" binary format used by haddock to construct hyperlinks between documentation of different packages.
What I'd like to propose a classic "separate content and presentation" refactor.
In particular, I'd suggest an output format that is slightly more abstract than html -- either xml or json. Ideally this format would be semi-fixed, or backwards compatible in its evolution. Call the files h-json
files for "haddock json" or the like. The haddock executable could then be run in two modes -- one of which actually builds the source and outputs, html, h-json, whatever. The other mode need not take any source as input at all -- rather it just takes h-json
files as input, and outputs the resultant html
or latex
or etc.
Ideally other tools besides haddock could make use of these h-json
files -- ides, engines for indexing and searching haskell code, etc. Furthermore, hackage-server itself could then invoke haddock as a library to generate html on-the-fly from hjson files, and produce uniform haddocks based on the latest templates (even for packages whose h-json was created by the hackage builder years ago).
Does this seem like a plan people would be on board with?