mkdir -p ./src/data/file
npx rescript-tools@0.6.6 doc <my_project>/src/File.res > ./src/data/file/File.json
pnpm install
pnpm run dev
I’ve added Sury as a package to try documenting external packages
https://rescript-reasonably-typed.netlify.app/reference/sury/s/
This is my script I used to add it: update.sh
Wow this is great! Documentation is definitely something a bit subpar in the ecosystem, such initiatives can improve the situation a lot! Thanks @lil5!
Great work @lil5 ! This is definitely an area that needs attention.
We recently did some work (that hasn’t been properly packaged for end use yet) for:
- Formatting all example code in docstrings
- Extracting all example code from docstrings (so you can compile and run them as tests for example)
It’s currently available in v12 via the Tools package: rescript/tools/bin/main.ml at master · rescript-lang/rescript · GitHub
Maybe that’s something that could be of interest as well. At some point, I’d love it if we made it super simple to:
- Write and maintain working example code in docstrings
- Package up the playground so you could embed your own ReScript code editor on your website/in your docs, and put your examples in there easily
Some loose thoughts. Anyway, great work!
@zth The json gives me the doc strings:
https://rescript-reasonably-typed.netlify.app/reference/array-async/arrayasync/
But before adding it to the json it adds page breaks if the text is too long, I had to do some text replacements to make it work
On top of that does rescript support this syntax or should I be removing *
?
/** comment
* line
*/
We don’t currently support that syntax, but I really think we should, given it’s so common in the JS ecosystem. Reading up on the semantics, it seems the behavior should just be to drop one leading *
on newlines, if present. This sounds like something simple, and definitely something we should support for interops sake.