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

Recursively generate docs for all .nim files (excluding tests) in the prj dir #3

Open
kaushalmodi opened this issue Oct 19, 2018 · 1 comment

Comments

@kaushalmodi
Copy link
Owner

kaushalmodi commented Oct 19, 2018

@kaushalmodi
Copy link
Owner Author

Ref: https://github.com/jabbalaci/NimMultiModuleLibrary


Generate docs for a multi-modules library

This is an example that shows how to create docs for
a library that contains several modules.

Here we achieve the following things:

  • We have a library that has a main module (src/stuff.nim)
    and some submodules (src/stuff/*.nim).
  • We generate HTML docs for every *.nim file.
  • We also generate an index file (theindex.html) that
    contains exported things from every module.
  • The theindex.html file has links to every module.
    The links work :)
  • If you click on the name of a module in theindex.html,
    you get to the HTML documentation of that specific module.

As putting all these things together took me some time and I
didn't find a step-by-step documentation, I assembled
this sample project.

Under Linux, I had to execute the following commands:

$ nim doc --index:on -o:docs/htmldocs/stuff.html src/stuff.nim
$ nim doc --index:on -o:docs/htmldocs/submodule1.html src/stuff/submodule1.nim
$ nim doc --index:on -o:docs/htmldocs/submodule2.html src/stuff/submodule2.nim

$ nim buildIndex docs/htmldocs/

$ mv docs/htmldocs/*.html docs/

# delete docs/htmldocs/

# open docs/theindex.html

See also 03_generate_docs.sh.

It would be nice if nim doc could do this with a switch. Generating
a complete documentation for a multi-module library should be easy.

Courtesy: @jabbalaci

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

No branches or pull requests

1 participant