I'm looking for a way to get comments from class and function at runtime in an Angular app in purpose to generate a custom doc. Using an external tool to generate the documentation doesn't fit my requirements. I really need to generate the documentation by myself.
I've made some trials and, for now, I have two possible cases:
-
Loading the concerned classes as a string and extract the comments with string manipulations (not the best case in my opinion).
-
Importing the classes and use ts to extract the comments. At this point I encounter some errors in my Angular app when I try to import ts:
import * as ts from 'typescript'
. It obviously causes a circular reference. This code shows how to extract comments from a class but it seems it cannot be used in an Angular app at runtime : comment factory from TypeDoc sources
Does someone have an idea of a way to extract comments from a class reference or from a string representing the class?
Aucun commentaire:
Enregistrer un commentaire