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

Docs: experiment with docsify #139

Merged
merged 3 commits into from
Feb 14, 2022
Merged

Docs: experiment with docsify #139

merged 3 commits into from
Feb 14, 2022

Conversation

jchavarri
Copy link
Collaborator

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:

  • It is very minimal and clean
  • It is well integrated with markdown
  • It support full text search out of the box
  • And multi-lang, which could be useful
  • Can be read from mobile
  • No build step, just an html file (can be served with python -m SimpleHTTPServer, docsify-cli or any other server)

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):

  • Introduction
  • Main concepts
  • Guides
  • API

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.


Jsoo-react components are functions that take input data and returns what to display. The library provides a DSL that allows to create elements like `div`, or `p` with just plain OCaml functions. The uppercase component props are passed as labelled arguments, while lowercase components take an array of attributes.

[filename](snippets/basic.ml ':include :type=code :fragment=demo')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:clever:

}
</script>
<!-- Docsify v4 patched -->
<script src="//cdn.jsdelivr.net/npm/@jchavarri/[email protected]"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@jchavarri
Copy link
Collaborator Author

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

@jchavarri jchavarri merged commit 6c51372 into main Feb 14, 2022
@jchavarri jchavarri deleted the docs-v1 branch February 14, 2022 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants