I'm working on the implementation of typedoc for my company's documentation. I've been working with TypeDoc without issues for months but I've been stuck on something for days now.
I'm trying to modify the comments for functions in my documentation. For other types its easy, i just grab the "comment.summary" element in the components i grab from the converter.EVENT_CREATE_DELCLARATION and modify them. However, for functions (kind 64), the "comment" attribute is empty, even if there is a comment displayed in the documentation.
name: 'addCalculatedMeasure',
kind: 64,
variant: 'declaration',
conversionFlags: 0,
comment: undefined,
escapedName: 'addCalculatedMeasure',
sources: [
SourceReference {
fileName: '/home/adamlr/Documents/atoti-ui/packages/mdx/dist/addCalculatedMeasure.d.ts',
fullFileName: '/home/adamlr/Documents/atoti-ui/packages/mdx/dist/addCalculatedMeasure.d.ts',
line: 7,
character: 24
}
For reference, this is how another type looks :
name: 'CellSetTable',
kind: 64,
variant: 'declaration',
conversionFlags: 1,
comment: Comment {
blockTags: [],
modifierTags: Set(0) {},
summary: [ [Object] ]
},
escapedName: 'CellSetTable',
sources: [
SourceReference {
fileName: '/home/adamlr/Documents/atoti-ui/packages/table/dist/cellset-table/CellSetTable.d.ts',
fullFileName: '/home/adamlr/Documents/atoti-ui/packages/table/dist/cellset-table/CellSetTable.d.ts',
line: 23,
character: 21
}
]
Any idea of where the comment for the first element might be hidden ? Thanks for your help.
(Using TypeDoc 0.24.7, Typescript 5.0.4)
Comments for functions are unfortunately the most convoluted part of TypeDoc's models. In general, the comment you want will be on
reflection.signatures[i].comment, but signatures are not created at the timeEVENT_CREATE_DECLARATIONis fired, so you will want to listen toConverter.EVENT_CREATE_SIGNATUREto pick up those comments.Note: There may be a comment on the wrapping function declaration as well. If there is, this comment will be later copied to any signatures which do not have a comment.