Skip to content

Commit a0cdd78

Browse files
committed
sort index
1 parent 5557c7b commit a0cdd78

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

crates/emmylua_doc_cli/src/markdown_generator/index_gen.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ use tera::Tera;
22

33
use super::MkdocsIndex;
44

5-
pub fn generate_index(tl: &Tera, mkdocs: &MkdocsIndex, output: &std::path::PathBuf) -> Option<()> {
5+
pub fn generate_index(tl: &Tera, mkdocs: &mut MkdocsIndex, output: &std::path::PathBuf) -> Option<()> {
66
let mut context = tera::Context::new();
7+
mkdocs.types.sort_by(|a, b| a.name.cmp(&b.name));
8+
mkdocs.modules.sort_by(|a, b| a.name.cmp(&b.name));
9+
10+
711
if !mkdocs.types.is_empty() {
812
context.insert("types", &mkdocs.types);
913
}

crates/emmylua_doc_cli/src/markdown_generator/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub fn generate_markdown(
5959
mod_gen::generate_module_markdown(db, &tl, module, &input, &module_out, &mut mkdocs_index);
6060
}
6161

62-
index_gen::generate_index(&tl, &mkdocs_index, output);
62+
index_gen::generate_index(&tl, &mut mkdocs_index, output);
6363
Some(())
6464
}
6565

0 commit comments

Comments
 (0)