rhai-autodocs
Generate Markdown/MDX documentation from a rhai::Engine
instance.
Published with Mdbook.
Published with Docusaurus.
Features
- Output native Rust Rhai function and custom types documentation as Markdown with HTML and Docusaurus with MDX.
- Function ordering using the
# rhai-autodocs:index:x
directive in your docs. - Rust docs 'sections' (
# Section
in markdown) displayed with tabs.
How to use
use exported_module;
use *;
// 1. Create a plugin module or any kind of Rhai API that supports documentation on functions and types.
/// My own module.
// 2. Generate the docs with autodocs. This library can be imported as a build dependency into your build script.
// A typical documentation generation workflow would look like this:
// Specify an environment variable that points to the directory
// where the documentation will be generated.
let docs_path = var.unwrap_or;
let mut engine = new;
// We register the module defined in the previous code block for this example,
// but you could register other functions and types ...
engine.register_static_module;
let docs = options
.include_standard_packages
.generate
.expect;
// Write the documentation in a file, or output to stdout, etc.
for in generate_for_docusaurus.expect
You need to import the styles/default.css
file and src/tabs.js
script for everything to work correctly using the mdbook generation. (You can of course override the styles and javascript code if you wish)
For more details, see the examples.