{"id":29066909,"url":"https://github.com/rhaiscript/rhai-doc","last_synced_at":"2025-06-27T10:08:55.037Z","repository":{"id":57660876,"uuid":"324670357","full_name":"rhaiscript/rhai-doc","owner":"rhaiscript","description":"Tool to auto-generate documentation for Rhai source code.","archived":false,"fork":false,"pushed_at":"2023-11-28T02:03:38.000Z","size":241,"stargazers_count":17,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-12T13:03:27.613Z","etag":null,"topics":["documentation-generator","rhai","rhai-doc","scripting-language"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/rhai-doc","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhaiscript.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-27T02:13:14.000Z","updated_at":"2024-12-18T05:16:53.000Z","dependencies_parsed_at":"2023-01-23T12:01:14.211Z","dependency_job_id":null,"html_url":"https://github.com/rhaiscript/rhai-doc","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rhaiscript/rhai-doc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaiscript%2Frhai-doc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaiscript%2Frhai-doc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaiscript%2Frhai-doc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaiscript%2Frhai-doc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhaiscript","download_url":"https://codeload.github.com/rhaiscript/rhai-doc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaiscript%2Frhai-doc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262235784,"owners_count":23279567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["documentation-generator","rhai","rhai-doc","scripting-language"],"created_at":"2025-06-27T10:08:53.382Z","updated_at":"2025-06-27T10:08:55.020Z","avatar_url":"https://github.com/rhaiscript.png","language":"Rust","readme":"`rhai-doc` - Generates HTML Documentation from Rhai Script Files\n==============================================================\n\n[![License](https://img.shields.io/crates/l/rhai)](https://github.com/license/rhaiscript/rhai-doc)\n[![crates.io](https://img.shields.io/crates/v/rhai-doc?logo=rust)](https://crates.io/crates/rhai-doc/)\n[![crates.io](https://img.shields.io/crates/d/rhai-doc?logo=rust)](https://crates.io/crates/rhai-doc/)\n\n`rhai-doc` is a tool for auto-generating documentation for [Rhai] scripts.\n\nIt supports writing [MarkDown] documentation in [doc-comments] of [Rhai] scripts and creating\ngeneral-purpose documentation pages.\n\nSee an example [here](https://rhai.rs/rhai-doc).\n\n\nCLI Interface\n-------------\n\n```text\nUSAGE:\n    rhai-doc.exe [OPTIONS] [SUBCOMMAND]\n\nOPTIONS:\n    -a, --all              Generate documentation for all functions, including private ones\n    -c, --config \u003cFILE\u003e    Set the configuration file [default: rhai.toml]\n    -d, --dir \u003cDIR\u003e        Set the Rhai scripts (*.rhai) directory [default: .]\n    -D, --dest \u003cDIR\u003e       Set the destination for the documentation output [default: dist]\n    -h, --help             Print help information\n    -p, --pages \u003cDIR\u003e      Set the directory where MarkDown (*.md) pages files are located [default:\n                           pages]\n    -v, --verbose          Use multiple to set the level of verbosity: 1 = silent, 2 (default) =\n                           full, 3 = debug\n    -V, --version          Print version information\n\nSUBCOMMANDS:\n    help    Print this message or the help of the given subcommand(s)\n    new     Generates a new configuration file\n```\n\n\nInstallation\n------------\n\n### Install from `crates.io`\n\n```sh\ncargo install rhai-doc\n```\n\n### Install from source\n\n```sh\ncargo install --path .\n```\n\n\nConfiguration File\n------------------\n\nTo get started, you need a configuration file.\n\nIt is usually named `rhai.toml`, or you can specify one via the `--config` option.\n\nTo generate a skeleton `rhai.toml`, use the `new` command:\n\n```sh\nrhai-doc new\n```\n\n### Example\n\n```toml\nversion = \"1.0\"                         # version of this TOML file\nname = \"My Rhai Project\"                # project name\ncolor = [246, 119, 2]                   # theme color\nroot = \"/docs/\"                         # root URL for generated site\nindex = \"home.md\"                       # this file becomes 'index.html`\nicon = \"logo.svg\"                       # project icon\nstylesheet = \"my_stylesheet.css\"        # custom stylesheet\ncode_theme = \"atom-one-light\"           # 'highlight.js' theme\ncode_lang = \"ts\"                        # default language for code blocks\nextension = \"rhai\"                      # script extension\ngoogle_analytics = \"G-ABCDEF1234\"       # Google Analytics ID\n\n[[links]]                               # external link for 'Blog'\nname = \"Blog\"\nlink = \"https://example.com/blog\"\n\n[[links]]                               # external link for 'Tools'\nname = \"Tools\"\nlink = \"https://example.com/tools\"\n```\n\n### Configuration options\n\n- `version`: Version of this TOML file; `1.0` is the current version.\n- `name`: The name of the project, if any. It's the title that shows up on the documentation pages.\n- `color`: RGB values of the theme color for the generated docs, if any.\n- `root`: The root URL generated as part of the documentation, if any.\n- `index`: The main [MarkDown] file, if any, that will become `index.html`.\n- `icon`: The location of a custom icon file, if any.\n- `stylesheet`: The location of a custom stylesheet, if any.\n- `code_theme`: The [`highlight.js`](https://highlightjs.org/) theme for syntax highlighting in code blocks (default `default`).\n- `code_lang`: Default language for code blocks (default `ts`).\n- `extension`: The extension of the script files `rhai-doc` will look for (default `.rhai`).\n- `google_analytics`: Google Analytics ID, if any.\n- `[[links]]`: External links, if any, to other sites of relevance.\n  - `name`: Title of external link.\n  - `link`: URL of external link.\n\n\nDoc-Comments\n------------\n\n[Rhai] supports [doc-comments] in [MarkDown] format on script-defined\n[functions](https://rhai.rs/book/language/functions.html).\n\n```rust\n/// This function calculates a **secret number**!\n///\n/// Formula provided from this [link](https://secret_formula.com/calc_secret_number).\n///\n/// # Scale Factor\n/// Uses a scale factor obtained by calling [`get_contribution_factor`].\n///\n/// # Parameters\n/// `seed` - random seed to start the calculation\n///\n/// # Returns\n/// The secret number!\n///\n/// # Exceptions\n/// Throws when the seed is not positive.\n///\n/// # Example\n/// ```\n/// let secret = calc_secret_number(42);\n/// ```\nfn calc_secret_number(seed) {\n    if seed \u003c= 0 {\n        throw \"the seed must be positive!\";\n    }\n\n    let factor = get_contribution_factor(seed);\n\n    // Some very complex code skipped ...\n    // ...\n}\n\n/// This function is private and will not be included\n/// unless the `-a` flag is used.\nprivate fn get_multiply_factor() {\n    42\n}\n\n/// This function calculates a scale factor for use\n/// in the [`calc_secret_number`] function.\nfn get_contribution_factor(x) {\n    x * get_multiply_factor()\n}\n```\n\n\nSyntax Highlighting\n-------------------\n\n[`highlight.js`](https://highlightjs.org/) is used for syntax highlighting in code blocks.\n\nThe default language for code blocks is `ts` (i.e. TypeScript).  This default is chosen because Rhai\nsyntax mostly resembles JavaScript/TypeScript, and highlighting works properly for strings interpolation.\n\n\nInter-Script Links\n------------------\n\nFunctions documentation can cross-link to each other within the same script file.\n\nA link in the format ``[`my_func`]`` is automatically expanded to link to the documentation of\nthe target function (in this case `my_func`).\n\n\nMarkDown Pages\n--------------\n\nBy default, `rhai-doc` will generate documentation pages from [MarkDown] documents within a\n`pages` sub-directory under the scripts directory.\n\nAlternatively, you can specify another location via the `--pages` option.\n\n\nFeatures\n--------\n\n- [x] Generate documentation from [MarkDown] [doc-comments] in [Rhai] script files.\n- [x] Create general-purpose documentation pages.\n- [ ] Text search.\n- [ ] Linter for undocumented functions, parameters, etc.\n\n\nLicense\n-------\n\nLicensed under either of the following, at your choice:\n\n- [Apache License, Version 2.0](https://github.com/semirix/rhai-doc/blob/master/LICENSE-APACHE.txt), or\n- [MIT license](https://github.com/semirix/rhai-doc/blob/master/LICENSE-MIT.txt)\n\nUnless explicitly stated otherwise, any contribution intentionally submitted\nfor inclusion in this crate, as defined in the Apache-2.0 license,\nshall be dual-licensed as above, without any additional terms or conditions.\n\n\n[MarkDown]: https://en.wikipedia.org/wiki/Markdown\n[Rhai]: https://rhai.rs\n[doc-comments]: https://rhai.rs/book/language/doc-comments.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhaiscript%2Frhai-doc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhaiscript%2Frhai-doc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhaiscript%2Frhai-doc/lists"}