Generate documentation that can be included in the user guide
()
| 541 | |
| 542 | /// Generate documentation that can be included in the user guide |
| 543 | pub fn generate_config_markdown() -> String { |
| 544 | use std::fmt::Write as _; |
| 545 | |
| 546 | let s = Self::default(); |
| 547 | |
| 548 | let mut docs = "| key | default | description |\n".to_string(); |
| 549 | docs += "|-----|---------|-------------|\n"; |
| 550 | let mut entries = s.entries(); |
| 551 | entries.sort_unstable_by(|a, b| a.key.cmp(&b.key)); |
| 552 | |
| 553 | for entry in &entries { |
| 554 | let _ = writeln!( |
| 555 | &mut docs, |
| 556 | "| {} | {} | {} |", |
| 557 | entry.key, |
| 558 | entry.value.as_deref().unwrap_or("NULL"), |
| 559 | entry.description |
| 560 | ); |
| 561 | } |
| 562 | docs |
| 563 | } |
| 564 | } |