ocsigen / ts2ocaml

Generate OCaml bindings from TypeScript definitions via the TypeScript compiler API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support generating comments

tmattio opened this issue · comments

This would be absolutely amazing, the generated bindings could have documentation with odoc and using them in an editor would be much easier with the documentation on hover.

I think we have a proper comment support now 🙂
SnapCrab_2021-7-25_16-58-0_No-00_NoName (2)

Support for complete Markdown to odoc conversions is certainly not a necessary effort, but some conversions might be worth supporting, for example:

  • `...` -> [ ... ]
  • ```...``` -> {[ ... ]}

Markdown:

```sh
rm -rf /
```

odoc:

{@sh [
rm -rf /
]}

See also: https://ocaml.github.io/odoc/odoc_for_authors.html

@smorimoto This is actually complicated. TypeScript Compiler API only handles JSDoc tags (such as @param and @returns) and leaves Markdown texts as plain texts, which means we would have to add a markdown parser to implement this.

I discussed about this with the odoc team, and we may support it somewhere in the OCaml Platform in the future, and there seems to be no reason for us to do this right away.