From d5618e054ce541ac45278088651f0858f9fe24ed Mon Sep 17 00:00:00 2001 From: mkpoli Date: Sun, 25 Aug 2024 23:03:32 +0900 Subject: [PATCH] chore: Use title as name for non-ascii titles --- docs/src/html.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/src/html.rs b/docs/src/html.rs index bb6204a3ce..517235c7d1 100644 --- a/docs/src/html.rs +++ b/docs/src/html.rs @@ -307,11 +307,17 @@ impl<'a> Handler<'a> { *id_slot = (!id.is_empty()).then_some(id); - // Special case for things like "v0.3.0". + let title = self.peeked.as_ref().map(|text| text.to_string()); let name = if id.starts_with('v') && id.contains('.') { + // Special case for things like "v0.3.0". id.into() - } else { + } else if title.iter().all(|c| c.is_ascii()) { id.to_title_case().into() + } else { + self.ids + .alloc(title.expect("heading should always have a title")) + .as_str() + .into() }; let mut children = &mut self.outline;