style(uudoc): update header formatting for options and examples (#10004)

Adjust the formatting of the options and examples sections in the
uudoc output to use Markdown headers:

- Change `<h2>Options</h2>` to `## Options`
- Change `Examples` to `## Examples`
- Add regression test to prevent reverting to HTML headers
This commit is contained in:
Haowei Hsu
2026-01-03 17:58:45 +01:00
committed by GitHub
parent 49466a3e0b
commit 730b0a6590
2 changed files with 40 additions and 2 deletions
+4 -2
View File
@@ -465,7 +465,9 @@ impl MDWriter<'_, '_> {
/// # Errors
/// Returns an error if the writer fails.
fn options(&mut self) -> io::Result<()> {
writeln!(self.w, "<h2>Options</h2>")?;
writeln!(self.w)?;
writeln!(self.w, "## Options")?;
writeln!(self.w)?;
write!(self.w, "<dl>")?;
for arg in self.command.get_arguments() {
write!(self.w, "<dt>")?;
@@ -576,7 +578,7 @@ fn format_examples(content: String, output_markdown: bool) -> Result<String, std
use std::fmt::Write;
let mut s = String::new();
writeln!(s)?;
writeln!(s, "Examples")?;
writeln!(s, "## Examples")?;
writeln!(s)?;
for line in content.lines().skip_while(|l| !l.starts_with('-')) {
if let Some(l) = line.strip_prefix("- ") {