#scripting #scripting-engine #scripting-language #documentation

rhai-autodocs

Custom documentation generator for the Rhai scripting language

7 releases

new 0.1.6 Mar 23, 2023
0.1.5 Mar 16, 2023
0.1.2 Feb 2, 2023
0.1.0 Jan 3, 2023

#192 in Development tools

Download history 584/week @ 2022-12-29 1561/week @ 2023-01-05 795/week @ 2023-01-12 1480/week @ 2023-01-19 1458/week @ 2023-01-26 676/week @ 2023-02-02 788/week @ 2023-02-09 1213/week @ 2023-02-16 527/week @ 2023-02-23 783/week @ 2023-03-02 1142/week @ 2023-03-09 1491/week @ 2023-03-16

4,132 downloads per month
Used in 3 crates

MIT license

29KB
677 lines

rhai-autodocs

Generate Markdown documentation from a rhai::Engine instance.

generated documentation

Features

  • Output Rhai documentation as Markdown w/ HTML.
  • Function ordering.
  • Rust docs 'sections' format with default Markdown format or displayed using tabs.

How to use

This library can be imported as a build dependency into your build script. A typical documentation generation workflow would look like this:

// -- build.rs
fn main() {
    // Specify an environment variable that points to the directory
    // where the documentation will be generated.
    if let Ok(docs_path) = std::env::var("DOCS_DIR") {
        let mut engine = rhai::Engine::new();

        // register custom functions and types ...

        let docs = rhai_autodocs::options()
            .include_standard_packages(false)
            .generate(&engine)
            .expect("failed to generate documentation");

        // Write the documentation in a file, or output to stdout, etc.
    }
}

You need to import the styles/default.css file and src/tabs.js script for everything to work correctly. (You can of course override the styles and javascript code if you wish) The generated markdown / HTML works best with mdbook. See the mdbook example for more details.

Dependencies

~4.5MB
~89K SLoC