nim doc and nim jsondoc at the moment seem to have duplicate logic for the implementation, `nimdoc.genJsonItem` and `nimdoc.genItem` do both write out result formats right away -- in JSON case it is code like let paramName = $n[paramsPos][paramIdx][identIdx] paramType = $n[paramsPos][paramIdx][^2] if n[paramsPos][paramIdx][^1].kind != nkEmpty: let paramDefault = $n[paramsPos][paramIdx][^1] result.json["signature"]["arguments"].add %{"name": %paramName, "type": %paramType, "default": %paramDefault} else: result.json["signature"]["arguments"].add %{"name": %paramName, "type": %paramType} Run
to transfer from PNodes to JSON immediately and HTML semantic analysis directly jumps into configuration dependent logic to fetch things like `doc.item.tocTable` and splice them together d.tocTable[k].mgetOrPut(cleanPlainSymbol, newSeq[TocItem]()).add TocItem( sortName: sortName, content: getConfigVar(d.conf, "doc.item.tocTable") % [ "name", name, "header_plain", plainNameEsc, Run where `doc.item.tocTable` is something user can configure, the code above is in `genItem` which is called via chain genItem -< generateDoc -< processNode(docgen2.nim) -< processPipeline(pipelines.nim) -< processPipelineModule ... anyway, the logic for the action here is compute: compute: compute: compute: action Run whereas I'm mainly advocating for solution where we can do json_data: seq[NimModule] = compute: compute: compute: compute: html_value = rendering(json_data) # External user tools, custom rendering, anything Run