Vertispan / jsinterop-ts-defs

Ingests jsinterop-annotated Java and generates TypeScript definitions
Apache License 2.0
7 stars 3 forks source link

Support transforming docstrings #80

Closed niloc132 closed 1 year ago

niloc132 commented 1 year ago

Note that this ticket is assuming the use of typedoc to generate HTML from generated TS files.

Presently the annotation-processor implementation of this project copies javadoc strings directly into typescript doc strings, with no additional transformations, which has a few side effects.

Other tags we might want to support can be found at https://typedoc.org/guides/tags/. For many of these, we could either just have the Java author write the tag directly in javadoc, or possibly support explicit annotations (especially for the marker tags, like @enum or @experimental. @ignore, @hidden, @internal would be good too? For others, we might want a specific javadoc syntax, like @privateRemarks, or @example.

To implement this, an annotation processor probably is no longer appropriate, since that API doesn't seem to have the features we need to parse the javadoc into elements and let us do any walking/rewriting. However, the Javadoc api itself now (as of Java 9+) supports Elements, so can run the same code written for the annotation processor, and then also process each doc string as needed.

Proposed changes: