Skip to content

Commit 794d478

Browse files
Merge pull request #19638 from bbb651/doc-config-anchors
doc: Rework generated configuration to have anchors
2 parents 150bb4a + 2ffcb99 commit 794d478

File tree

3 files changed

+690
-358
lines changed

3 files changed

+690
-358
lines changed

crates/rust-analyzer/src/config.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ config_data! {
426426
///
427427
/// Similarly, the JSON representation of `DiscoverArgument::Buildfile` is:
428428
///
429-
/// ```
429+
/// ```json
430430
/// {
431431
/// "buildfile": "BUILD"
432432
/// }
@@ -3655,12 +3655,16 @@ fn validate_toml_table(
36553655
#[cfg(test)]
36563656
fn manual(fields: &[SchemaField]) -> String {
36573657
fields.iter().fold(String::new(), |mut acc, (field, _ty, doc, default)| {
3658-
let name = format!("rust-analyzer.{}", field.replace('_', "."));
3658+
let id = field.replace('_', ".");
3659+
let name = format!("rust-analyzer.{id}");
36593660
let doc = doc_comment_to_string(doc);
36603661
if default.contains('\n') {
3661-
format_to_acc!(acc, " **{name}**\n\nDefault:\n\n```{default}\n\n```\n\n {doc}\n\n ")
3662+
format_to_acc!(
3663+
acc,
3664+
"## {name} {{#{id}}}\n\nDefault:\n```json\n{default}\n```\n\n{doc}\n\n"
3665+
)
36623666
} else {
3663-
format_to_acc!(acc, "**{name}** (default: {default})\n\n {doc}\n\n")
3667+
format_to_acc!(acc, "## {name} {{#{id}}}\n\nDefault: `{default}`\n\n{doc}\n\n")
36643668
}
36653669
})
36663670
}

0 commit comments

Comments
 (0)