style: fixed pre_description having \t at the start

This commit is contained in:
Byson94
2025-08-30 21:43:49 +05:30
parent c81dd2c285
commit 14bac6d0c2

View File

@@ -3,7 +3,13 @@ use rhai::{Engine, module_resolvers::StaticModuleResolver};
use rhai_autodocs::{export::options, generate::mdbook};
use std::{env, fs, path::Path};
fn generate_docs(engine: &Engine, path: &str, filename: &str, include_std: bool, pre_description: &str) {
fn generate_docs(
engine: &Engine,
path: &str,
filename: &str,
include_std: bool,
pre_description: &str,
) {
let docs = options()
.include_standard_packages(include_std)
.export(engine)
@@ -39,19 +45,25 @@ fn main() {
let mut resolver = StaticModuleResolver::new();
// Generate global.md (full docs)
generate_docs(&engine, path, "global", true, r#"
# Global Builtin Rhai Functions
generate_docs(
&engine,
path,
"global",
true,
r#"
# Global Builtin Rhai Functions
These functions are built-in and available globally, meaning they can be used directly without any import.
These functions are built-in and available globally, meaning they can be used directly without any import.
For example, to get the value of PI, you can simply write:
```js
let x = PI();
```
For example, to get the value of PI, you can simply write:
This section covers all the core functions provided by Rhai that are ready to use out of the box.
"#);
```js
let x = PI();
```
This section covers all the core functions provided by Rhai that are ready to use out of the box.
"#,
);
// Generate stdlib.md docs (custom stdlib)
resolver.clear();
@@ -60,15 +72,21 @@ fn main() {
for (module_name, module) in resolver.iter() {
engine.register_static_module(module_name, module.clone());
}
generate_docs(&engine, path, "stdlib", false, r#"
# Std Library Module
generate_docs(
&engine,
path,
"stdlib",
false,
r#"
# Std Library Module
These are all the standard modules in ewwii.
These are all the standard modules in ewwii.
Each library in this module is under `std::<m>`, where `<m>` is the name of the specific module.
These modules provide essential functionalities that are will be useful for making widgets.
They cover tasks like string manipulation, environmental variable manipuation, running shell commands, and more.
"#);
Each library in this module is under `std::<m>`, where `<m>` is the name of the specific module.
These modules provide essential functionalities that are will be useful for making widgets.
They cover tasks like string manipulation, environmental variable manipuation, running shell commands, and more.
"#,
);
// Generate apilib.md docs
resolver.clear();
@@ -77,15 +95,21 @@ fn main() {
for (module_name, module) in resolver.iter() {
engine.register_static_module(module_name, module.clone());
}
generate_docs(&engine, path, "apilib", false, r#"
# API Library Module
generate_docs(
&engine,
path,
"apilib",
false,
r#"
# API Library Module
These are all the API modules available in ewwii.
These are all the API modules available in ewwii.
Each library in this module is under `api::<m>`, where `<m>` is the name of the specific module.
The API library provides system-level functionality, allowing you to interact with external resources and perform advanced operations. Examples include interacting with Wi-Fi, networking, and more.
"#);
Each library in this module is under `api::<m>`, where `<m>` is the name of the specific module.
The API library provides system-level functionality, allowing you to interact with external resources and perform advanced operations. Examples include interacting with Wi-Fi, networking, and more.
"#,
);
println!("Docs generation completed.");
}