ml-in-barcelona / jsoo-react

js_of_ocaml bindings for ReactJS. Based on ReasonReact.
https://ml-in-barcelona.github.io/jsoo-react
MIT License
138 stars 19 forks source link

Docs: experiment with docsify #139

Closed jchavarri closed 2 years ago

jchavarri commented 2 years ago

This is a small experiment for what could be the first version of docs (not counting existing example folder, which served its purpose, but I think can be retired now πŸ˜… ).

docs

This experiment is using docsify with some updates. I really liked docsify for a few reasons:

Some more things:

Embed .ml files

Through a tiny change in docsify, there is the possibility to embed ml files partially, only the part between comments with (* [demo] *) in them.

This allows to have the doc snippets compiled with dune (including ppx, etc) very easily, apply ocamlformat to them transparently too, and then use them in the docs directly, see docs/snippets/basic.ml and how it renders.

Embed html files from odoc

It is possible to embed html in docsify as well. This allows to produce some html with odoc, and then just copy the content to the docs folder to be shown with the rest of the docs, see example.

One question here is if we will be able to put all the docs at the top level component (React) because otherwise I don't think the embedding will work, as it'll be very hard to maintain (one has to reproduce the hierarchy of odoc manually in docsify). This is probably the part that makes me hesitate more.

Docs initial structure

I added as well some initial structure for the docs (more details about subsections in link below):

The example to see how all the above works can be seen in https://ml-in-barcelona.github.io/jsoo-react/docs/.

Let me know what you think :) any feedback welcome, about structure, choice of libs, embedding etc.

jchavarri commented 2 years ago

Merging this to keep working on docs, will open new PRs with added pages.