Skip to content

Commit 477a5ae

Browse files
Nero5023facebook-github-bot
authored andcommitted
Reuse write_docs_to_subdir to generate to docs
Summary: # This diff stack Separate the rules at https://buck2.build/docs/prelude/globals/ into separate pages. Each page will have it's own page. With such change it will be more clean and it will be faster to open the page. # This diff This diff reuse `write_docs_to_subdir` to generate to docs, with such change, we can generate seperate pages for each rule. (Will do this in later diff) This diff also handles the case where `name` is empty when generating documentation in `write_docs_to_subdir`. Previously, this would result in a meaningless empty `# ` line in the generated documentation. Reviewed By: JakobDegen Differential Revision: D73931901 fbshipit-source-id: 8601b922c5527a03a8725784881e359e9b5e1eb6
1 parent 298a993 commit 477a5ae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

starlark/src/docs/markdown.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,13 @@ pub(super) fn render_members<'a>(
180180
let member_details: Vec<_> = after_summary.into_iter().chain(member_details).collect();
181181
let members_details = member_details.join("\n\n---\n\n");
182182

183-
format!("# {name}{summary}\n\n{members_details}")
183+
let header = if name == "" {
184+
"".to_owned()
185+
} else {
186+
format!("# {name}")
187+
};
188+
189+
format!("{header}{summary}\n\n{members_details}")
184190
}
185191

186192
pub(super) fn render_doc_type(

0 commit comments

Comments
 (0)