Documentarian: Generate simple API documentation #612
pyrmont
started this conversation in
Show and tell
Replies: 1 comment
-
Can't wait to use this. Thanks, @pyrmont ! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Documentarian is a small tool for generating a simple document describing the API of a Janet project. The document produced by the default template is intended to look especially good in a GitHub repository. You can see an example of what this looks like in the API document for my testing library, Testament.
Documentarian isn't new, but I've just pushed out a version that adds some new features and thought I'd take the opportunity to highlight some of what it can do:
Source Code Links: Links to the line in the source code at which a binding is defined. This includes bindings that are exported from other modules within the same higher-level namespace as well as functions that are forward declared with
varfn
.Private Bindings: Optionally displays private bindings. By default, private bindings are not shown in the generated documentation but you can use a command-line argument to change this.
Custom Templates: Accepts custom templates. The API document is generated using a Mustache template. If you want more control, you can specify a template file at the commend line with your own Mustache template.
Module-Level Docstrings: Recognises module-level docstrings. These are strings defined at the top-level of a module using the
(setdyn :doc "This is the docstring.")
pattern.Project-Level Docstrings: Recognises project-level docstrings. These are strings defined under the
:doc
keyword in thedeclare-project
form in aproject.janet
file.Native Module Documentation: (Experimental) Generates documentation for native modules (i.e. code written in C). This documentation is created by parsing the source file directly rather than Janet's in-built documentation generating functionality. The advantage of this mechanism is that the documentation generated includes links to the relevant lines in the source code.
Special thanks to @subsetpark for his suggestions about how to improve Documentarian. If you have any ideas or find a bug, please let me know!
Beta Was this translation helpful? Give feedback.
All reactions