Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Improve API documentation with small examples #1020

Open
olleharstedt opened this issue May 27, 2020 · 6 comments
Open

[Doc] Improve API documentation with small examples #1020

olleharstedt opened this issue May 27, 2020 · 6 comments

Comments

@olleharstedt
Copy link

I'd like to supply the API docs with example snippets to show how the module is used. Just reading function listings is not always the best way to learn. Such snippets will have to be maintained, though, so it is a commitment to include it. What do you think?

@olleharstedt olleharstedt changed the title Improve API documentation with small examples [Doc] Improve API documentation with small examples May 27, 2020
@TyOverby
Copy link
Collaborator

I think that the folks working on mdx have some support for building and running examples in MLI doc-comments. If we could get that working, then maintaining them would be way easier

@dbuenzli
Copy link
Contributor

A simpler approach would be to add the ability to extract code blocks to files in odoc. There's wip by here by @rizo but sadly it seems to have stalled, the discussion got bogged down, in my opinion, into needless complexity.

@olleharstedt
Copy link
Author

Hm, not sure why execution would be necessary. The snippets might not be complete anyway. I just thinking more of docblock tags to include code examples.

@olleharstedt
Copy link
Author

@dbuenzli
Copy link
Contributor

@olleharstedt this already exists. In the ocamldoc language you can write code between {[ ... ]}. The point of extraction is to make sure they compile which help with maintaining them.

@olleharstedt
Copy link
Author

Perfect is the enemy of good...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants