From a786497ce0255e1ca2dcdcab46030786c1b9e98e Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 11 Sep 2025 06:18:36 +0000 Subject: fix(markdown): Optimise Markdown conversion --- src/ast/container.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/ast') diff --git a/src/ast/container.rs b/src/ast/container.rs index 46c548b..fe4f949 100644 --- a/src/ast/container.rs +++ b/src/ast/container.rs @@ -199,18 +199,14 @@ impl Ast { // If the Gemtext line starts with an "=" ("=>"), it is a link line, // so splitting it up should be easy enough. let line = line.get(2..).unwrap_or(""); - let mut split = line - .split_whitespace() - .map(String::from) - .collect::>() - .into_iter(); + let mut split = line.split_whitespace(); nodes.push(Node::Link { - to: split.next().unwrap_or_default(), + to: split.next().unwrap_or_default().to_string(), text: { - let rest = split.collect::>().join(" "); + let rest: Vec<&str> = split.collect(); - if rest.is_empty() { None } else { Some(rest) } + if rest.is_empty() { None } else { Some(rest.join(" ")) } }, }); -- cgit v1.2.3