maplibre-react-native icon indicating copy to clipboard operation
maplibre-react-native copied to clipboard

Docs generator improvements

Open caspg opened this issue 7 months ago • 0 comments

Motivation

Component docs are autogenerated with scripts/autogenerate.js. There are two issues that we could try improve:

  1. Allow adding description with code examples to the component documentation.

I couldn't find a way to create nice description with code examples. @example tag (https://jsdoc.app/tags-example) doesn't seem to work.

CleanShot 2024-07-12 at 10 29 32@2x

  1. Better JSDoc for ref objects. This may be little bit harder to do and less important.

Components are functions which exposes methods using React.useImperativeHandle. To properly generate docs for those methods we need to add JSDocs. If we want to use it with TypeScript project, we can import MapViewRef interface but since this interface doesn't have JSDocs (only useImperativeHandle has it) we don't see documentation in the code editor.

We would have to duplicate JSDOc which doesn't sound like a good idea. Maybe our script could use doc from the ref interface somehow?

CleanShot 2024-07-12 at 10 43 21@2x

caspg avatar Jul 12 '24 08:07 caspg