diff options
| author | Fuwn <[email protected]> | 2025-09-11 06:18:36 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-09-11 06:18:36 +0000 |
| commit | a786497ce0255e1ca2dcdcab46030786c1b9e98e (patch) | |
| tree | c50126f55d4b8a703b2791fc4a264a4bccc828d2 /src/ast | |
| parent | fix(meta): Better comply with RFC 2045 (diff) | |
| download | germ-a786497ce0255e1ca2dcdcab46030786c1b9e98e.tar.xz germ-a786497ce0255e1ca2dcdcab46030786c1b9e98e.zip | |
fix(markdown): Optimise Markdown conversion
Diffstat (limited to 'src/ast')
| -rw-r--r-- | src/ast/container.rs | 12 |
1 files changed, 4 insertions, 8 deletions
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::<Vec<String>>() - .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::<Vec<String>>().join(" "); + let rest: Vec<&str> = split.collect(); - if rest.is_empty() { None } else { Some(rest) } + if rest.is_empty() { None } else { Some(rest.join(" ")) } }, }); |