- Notifications
You must be signed in to change notification settings - Fork1
Tool to auto-generate documentation for Rhai source code.
License
Apache-2.0, MIT licenses found
Licenses found
rhaiscript/rhai-doc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
rhai-doc
is a tool for auto-generating documentation forRhai scripts.
It supports writingMarkDown documentation indoc-comments ofRhai scripts and creatinggeneral-purpose documentation pages.
See an examplehere.
USAGE: rhai-doc.exe [OPTIONS] [SUBCOMMAND]OPTIONS: -a, --all Generate documentation for all functions, including private ones -c, --config <FILE> Set the configuration file [default: rhai.toml] -d, --dir <DIR> Set the Rhai scripts (*.rhai) directory [default: .] -D, --dest <DIR> Set the destination for the documentation output [default: dist] -h, --help Print help information -p, --pages <DIR> Set the directory where MarkDown (*.md) pages files are located [default: pages] -v, --verbose Use multiple to set the level of verbosity: 1 = silent, 2 (default) = full, 3 = debug -V, --version Print version informationSUBCOMMANDS: help Print this message or the help of the given subcommand(s) new Generates a new configuration file
cargo install rhai-doc
cargo install --path.
To get started, you need a configuration file.
It is usually namedrhai.toml
, or you can specify one via the--config
option.
To generate a skeletonrhai.toml
, use thenew
command:
rhai-doc new
version ="1.0"# version of this TOML filename ="My Rhai Project"# project namecolor = [246,119,2]# theme colorroot ="/docs/"# root URL for generated siteindex ="home.md"# this file becomes 'index.html`icon ="logo.svg"# project iconstylesheet ="my_stylesheet.css"# custom stylesheetcode_theme ="atom-one-light"# 'highlight.js' themecode_lang ="ts"# default language for code blocksextension ="rhai"# script extensiongoogle_analytics ="G-ABCDEF1234"# Google Analytics ID[[links]]# external link for 'Blog'name ="Blog"link ="https://example.com/blog"[[links]]# external link for 'Tools'name ="Tools"link ="https://example.com/tools"
version
: Version of this TOML file;1.0
is the current version.name
: The name of the project, if any. It's the title that shows up on the documentation pages.color
: RGB values of the theme color for the generated docs, if any.root
: The root URL generated as part of the documentation, if any.index
: The mainMarkDown file, if any, that will becomeindex.html
.icon
: The location of a custom icon file, if any.stylesheet
: The location of a custom stylesheet, if any.code_theme
: Thehighlight.js
theme for syntax highlighting in code blocks (defaultdefault
).code_lang
: Default language for code blocks (defaultts
).extension
: The extension of the script filesrhai-doc
will look for (default.rhai
).google_analytics
: Google Analytics ID, if any.[[links]]
: External links, if any, to other sites of relevance.name
: Title of external link.link
: URL of external link.
Rhai supportsdoc-comments inMarkDown format on script-definedfunctions.
/// This function calculates a **secret number**!////// Formula provided from this [link](https://secret_formula.com/calc_secret_number).////// # Scale Factor/// Uses a scale factor obtained by calling [`get_contribution_factor`].////// # Parameters/// `seed` - random seed to start the calculation////// # Returns/// The secret number!////// # Exceptions/// Throws when the seed is not positive.////// # Example/// ```/// let secret = calc_secret_number(42);/// ```fncalc_secret_number(seed){if seed <=0{ throw"the seed must be positive!";}let factor =get_contribution_factor(seed);// Some very complex code skipped ...// ...}/// This function is private and will not be included/// unless the `-a` flag is used.privatefnget_multiply_factor(){42}/// This function calculates a scale factor for use/// in the [`calc_secret_number`] function.fnget_contribution_factor(x){ x*get_multiply_factor()}
highlight.js
is used for syntax highlighting in code blocks.
The default language for code blocks ists
(i.e. TypeScript). This default is chosen because Rhaisyntax mostly resembles JavaScript/TypeScript, and highlighting works properly for strings interpolation.
Functions documentation can cross-link to each other within the same script file.
A link in the format[`my_func`]
is automatically expanded to link to the documentation ofthe target function (in this casemy_func
).
By default,rhai-doc
will generate documentation pages fromMarkDown documents within apages
sub-directory under the scripts directory.
Alternatively, you can specify another location via the--pages
option.
- Generate documentation fromMarkDowndoc-comments inRhai script files.
- Create general-purpose documentation pages.
- Text search.
- Linter for undocumented functions, parameters, etc.
Licensed under either of the following, at your choice:
Unless explicitly stated otherwise, any contribution intentionally submittedfor inclusion in this crate, as defined in the Apache-2.0 license,shall be dual-licensed as above, without any additional terms or conditions.
About
Tool to auto-generate documentation for Rhai source code.
Topics
Resources
License
Apache-2.0, MIT licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.