From f16682d9561abcec61471fa157be18d9fcc6af31 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 3 Aug 2024 18:20:48 +0000 Subject: feat(ast): arbitrary heading depth generation --- Cargo.toml | 2 +- src/ast/container.rs | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8fc5227..90710fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "germ" -version = "0.4.4" +version = "0.4.5" authors = ["Fuwn "] edition = "2021" description = "The Ultimate Gemini Toolkit." diff --git a/src/ast/container.rs b/src/ast/container.rs index c8f9ecf..b255ec7 100644 --- a/src/ast/container.rs +++ b/src/ast/container.rs @@ -124,16 +124,8 @@ impl Ast { to, text.clone().map_or_else(String::new, |text| format!(" {text}")), )), - Node::Heading { level, text } => gemtext.push_str(&format!( - "{} {}\n", - match level { - 1 => "#", - 2 => "##", - 3 => "###", - _ => "", - }, - text - )), + Node::Heading { level, text } => + gemtext.push_str(&format!("{} {}\n", "#".repeat(*level), text)), Node::List(items) => gemtext.push_str(&format!( "{}\n", items -- cgit v1.2.3