diff --git a/crates/pseudoscript-doc/src/health.rs b/crates/pseudoscript-doc/src/health.rs index 3367d18..aa75252 100644 --- a/crates/pseudoscript-doc/src/health.rs +++ b/crates/pseudoscript-doc/src/health.rs @@ -24,12 +24,10 @@ pub(crate) fn build_health( .iter() .map(|d| { let node = owning_node(graph, d); - let href = node - .and_then(|n| urls.get(&n.fqn)) - .map_or_else( - || format!("{prefix}{}", module_page_path(&d.module)), - |url| format!("{prefix}{}#{}", url.page, url.anchor), - ); + let href = node.and_then(|n| urls.get(&n.fqn)).map_or_else( + || format!("{prefix}{}", module_page_path(&d.module)), + |url| format!("{prefix}{}#{}", url.page, url.anchor), + ); HealthEntry { module: d.module.clone(), severity: d.severity.clone(), diff --git a/crates/pseudoscript-doc/src/highlight.rs b/crates/pseudoscript-doc/src/highlight.rs index 14849fc..0c441ce 100644 --- a/crates/pseudoscript-doc/src/highlight.rs +++ b/crates/pseudoscript-doc/src/highlight.rs @@ -121,8 +121,14 @@ mod tests { #[test] fn pds_blocks_highlight_keywords_strings_and_docs() { let html = highlight("pds", "/// A shop.\npublic system Shop;\n"); - assert!(html.contains("public"), "{html}"); - assert!(html.contains("system"), "{html}"); + assert!( + html.contains("public"), + "{html}" + ); + assert!( + html.contains("system"), + "{html}" + ); assert!(html.contains("tok-doc"), "{html}"); assert!(html.contains("Shop"), "plain idents survive: {html}"); } diff --git a/crates/pseudoscript-doc/src/lib.rs b/crates/pseudoscript-doc/src/lib.rs index caa5a66..b9ae465 100644 --- a/crates/pseudoscript-doc/src/lib.rs +++ b/crates/pseudoscript-doc/src/lib.rs @@ -87,7 +87,11 @@ pub fn try_render_site_with( shell::wrap(path, props, &props_json, &result), )); } - files.push(search::build_search_index(graph, config, &crate::url::UrlMap::build(graph))); + files.push(search::build_search_index( + graph, + config, + &crate::url::UrlMap::build(graph), + )); files.push(SiteFile::new("style.css", assets::STYLE_CSS)); files.push(SiteFile::new("client.js", assets::CLIENT_JS)); files.push(SiteFile::new("universe.js", assets::UNIVERSE_JS)); diff --git a/crates/pseudoscript-doc/src/render.rs b/crates/pseudoscript-doc/src/render.rs index b9a8725..f15d128 100644 --- a/crates/pseudoscript-doc/src/render.rs +++ b/crates/pseudoscript-doc/src/render.rs @@ -61,7 +61,15 @@ pub(crate) fn build_pages( for module in &modules { pages.push(( module_page_path(module), - build_module(graph, config, module, &modules, &urls, diagnostics, svg_theme), + build_module( + graph, + config, + module, + &modules, + &urls, + diagnostics, + svg_theme, + ), )); } pages.push(( @@ -254,7 +262,13 @@ fn build_index( .collect(); let page = PageBody::Index(IndexProps { title: config.name.clone(), - context_diagram: build_svg_diagram(graph, View::Context, "Context", "System context", svg_theme), + context_diagram: build_svg_diagram( + graph, + View::Context, + "Context", + "System context", + svg_theme, + ), cards, stats: build_stats(graph, diagnostics), }); @@ -692,7 +706,12 @@ mod tests { #[test] fn pages_emit_in_order_index_docs_modules_universe_health() { let g = graph(&[WorkspaceModule::new("m", "//! m\npublic system S;")]); - let pages = build_pages(&g, &config_with_docs(), &[], pseudoscript_emit::Theme::Adaptive); + let pages = build_pages( + &g, + &config_with_docs(), + &[], + pseudoscript_emit::Theme::Adaptive, + ); let paths: Vec<&str> = pages.iter().map(|(p, _)| p.as_str()).collect(); assert_eq!(paths[0], "index.html"); assert_eq!(paths[1], "docs/introduction.html"); @@ -704,7 +723,12 @@ mod tests { #[test] fn doc_page_carries_rendered_markdown_and_sidebar_group() { let g = graph(&[WorkspaceModule::new("m", "//! m\npublic system S;")]); - let pages = build_pages(&g, &config_with_docs(), &[], pseudoscript_emit::Theme::Adaptive); + let pages = build_pages( + &g, + &config_with_docs(), + &[], + pseudoscript_emit::Theme::Adaptive, + ); let (_, doc) = pages .iter() .find(|(p, _)| p == "docs/introduction.html") @@ -723,7 +747,12 @@ mod tests { fn every_diagram_is_adaptive_inline_svg() { let src = "//! m\n/// Sys.\npublic system S;\npublic container C for m::S {\n #[manual]\n public Run() {\n self.Step()\n }\n Step();\n}\n"; let g = graph(&[WorkspaceModule::new("m", src)]); - let pages = build_pages(&g, &DocConfig::default(), &[], pseudoscript_emit::Theme::Adaptive); + let pages = build_pages( + &g, + &DocConfig::default(), + &[], + pseudoscript_emit::Theme::Adaptive, + ); let (_, module) = pages .iter() .find(|(p, _)| p.starts_with("module/")) @@ -745,7 +774,12 @@ mod tests { fn universe_page_carries_snapshot_flows_and_hrefs() { let src = "//! m\npublic system S;\npublic container C for m::S {\n #[manual]\n public Run() {\n m::D.Go()\n }\n}\npublic container D for m::S {\n public Go();\n}\n"; let g = graph(&[WorkspaceModule::new("m", src)]); - let pages = build_pages(&g, &DocConfig::default(), &[], pseudoscript_emit::Theme::Adaptive); + let pages = build_pages( + &g, + &DocConfig::default(), + &[], + pseudoscript_emit::Theme::Adaptive, + ); let (_, universe) = pages .iter() .find(|(p, _)| p == "universe.html") diff --git a/crates/pseudoscript-doc/src/render_md.rs b/crates/pseudoscript-doc/src/render_md.rs index 45804fc..5435418 100644 --- a/crates/pseudoscript-doc/src/render_md.rs +++ b/crates/pseudoscript-doc/src/render_md.rs @@ -95,7 +95,14 @@ fn render_universe(out: &mut String, universe: &UniverseProps) { if !universe.edges.is_empty() { out.push_str("## Relationships\n\n"); for edge in &universe.edges { - let _ = writeln!(out, "- `{}` \u{2192} `{}` ({} call{})", edge.from, edge.to, edge.traffic, if edge.traffic == 1 { "" } else { "s" }); + let _ = writeln!( + out, + "- `{}` \u{2192} `{}` ({} call{})", + edge.from, + edge.to, + edge.traffic, + if edge.traffic == 1 { "" } else { "s" } + ); } out.push('\n'); } @@ -104,7 +111,11 @@ fn render_universe(out: &mut String, universe: &UniverseProps) { for flow in &universe.flows { let _ = writeln!(out, "- **{}** (`{}`)", flow.name, flow.fqn); for hop in &flow.hops { - let _ = writeln!(out, " - `{}` \u{2192} `{}` — {}", hop.from, hop.to, hop.label); + let _ = writeln!( + out, + " - `{}` \u{2192} `{}` — {}", + hop.from, hop.to, hop.label + ); } } out.push('\n'); diff --git a/crates/pseudoscript-doc/src/search.rs b/crates/pseudoscript-doc/src/search.rs index 86aa77a..4f23c34 100644 --- a/crates/pseudoscript-doc/src/search.rs +++ b/crates/pseudoscript-doc/src/search.rs @@ -91,8 +91,16 @@ pub(crate) fn build_search_index(graph: &Graph, config: &DocConfig, urls: &UrlMa } for (name, href, summary) in [ - ("3D Universe", "universe.html", "The model in 3D — structure and flows"), - ("Architecture Health", "health.html", "Errors, warnings, and principle lints"), + ( + "3D Universe", + "universe.html", + "The model in 3D — structure and flows", + ), + ( + "Architecture Health", + "health.html", + "Errors, warnings, and principle lints", + ), ] { entries.push(SearchEntry { fqn: href.to_owned(), @@ -107,10 +115,7 @@ pub(crate) fn build_search_index(graph: &Graph, config: &DocConfig, urls: &UrlMa entries.sort_by(|a, b| a.href.cmp(&b.href).then_with(|| a.fqn.cmp(&b.fqn))); let json = serde_json::to_string(&entries).unwrap_or_else(|_| "[]".to_owned()); - SiteFile::new( - "search-index.js", - format!("window.__PDS_SEARCH__={json};"), - ) + SiteFile::new("search-index.js", format!("window.__PDS_SEARCH__={json};")) } /// Strips Markdown to plain text: the text and code events space-joined, with @@ -161,6 +166,9 @@ mod tests { #[test] fn markdown_strips_to_plain_text() { - assert_eq!(markdown_text("# Hi\n\nSome **bold** `code`."), "Hi Some bold code ."); + assert_eq!( + markdown_text("# Hi\n\nSome **bold** `code`."), + "Hi Some bold code ." + ); } } diff --git a/crates/pseudoscript-doc/tests/markdown.rs b/crates/pseudoscript-doc/tests/markdown.rs index fd3adbb..6272237 100644 --- a/crates/pseudoscript-doc/tests/markdown.rs +++ b/crates/pseudoscript-doc/tests/markdown.rs @@ -48,10 +48,7 @@ fn writes_universe_and_health_pages() { ); let health = &site.file("health.md").expect("health.md").contents; - assert!( - health.contains("# Architecture health"), - "got:\n{health}" - ); + assert!(health.contains("# Architecture health"), "got:\n{health}"); assert!( health.contains("No findings."), "the clean fixture reports no findings, got:\n{health}" diff --git a/crates/pseudoscript-ide/src/lib.rs b/crates/pseudoscript-ide/src/lib.rs index 6d534af..ab54c6d 100644 --- a/crates/pseudoscript-ide/src/lib.rs +++ b/crates/pseudoscript-ide/src/lib.rs @@ -899,10 +899,8 @@ impl IdeSession { .iter() .map(|(fqn, m)| WorkspaceModule::new(fqn.clone(), m.source.clone())) .collect(); - let per_module = pseudoscript_model::check_workspace_modules_with_externals( - &modules, - &self.externals, - ); + let per_module = + pseudoscript_model::check_workspace_modules_with_externals(&modules, &self.externals); let diagnostics = pseudoscript_doc::prepare_diagnostics(&modules, &per_module); let graph = self.graph(); let site = try_render_site_with(graph, &doc_config(config), &diagnostics, &engine) diff --git a/crates/pseudoscript/src/main.rs b/crates/pseudoscript/src/main.rs index c9448f4..1b7a47b 100644 --- a/crates/pseudoscript/src/main.rs +++ b/crates/pseudoscript/src/main.rs @@ -884,11 +884,10 @@ fn build_site( // One per-module check pass feeds both the console report and the site's // health page. - let per_module = - pseudoscript_model::check_workspace_modules_with_externals( - &project.modules, - &project.dependencies, - ); + let per_module = pseudoscript_model::check_workspace_modules_with_externals( + &project.modules, + &project.dependencies, + ); report_diagnostics( &per_module .iter() @@ -899,10 +898,8 @@ fn build_site( let model = graph(&project.modules); let site = match format { - DocFormat::Html => { - pseudoscript_doc::try_render_site(&model, &project.config, &diagnostics) - .context("rendering the documentation site")? - } + DocFormat::Html => pseudoscript_doc::try_render_site(&model, &project.config, &diagnostics) + .context("rendering the documentation site")?, DocFormat::Md => { pseudoscript_doc::render_markdown_site(&model, &project.config, &diagnostics) } diff --git a/crates/pseudoscript/src/workspace.rs b/crates/pseudoscript/src/workspace.rs index 723ffa5..ee1e5c6 100644 --- a/crates/pseudoscript/src/workspace.rs +++ b/crates/pseudoscript/src/workspace.rs @@ -114,7 +114,10 @@ impl DocTable { /// Markdown from disk, relative to `root`. fn resolve(self, root: &Path) -> Result<(DocConfig, PathBuf, Option)> { let name = self.name.unwrap_or_else(|| default_name(root)); - let theme = self.theme.as_deref().map_or(Ok(Theme::System), parse_theme)?; + let theme = self + .theme + .as_deref() + .map_or(Ok(Theme::System), parse_theme)?; let format = self.format.as_deref().map(parse_format).transpose()?; let out = self.out.unwrap_or_else(|| "target/doc".to_owned()); let docs = self