🦠 The Definitive Gemini Protocol Toolkit
gemini gemini-protocol gemtext parser zero-dependency toolkit ast converter html markdown cli networking
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(ast): parse level 1 headings with emojis

Fuwn 522a8c79 b1be3252

+9 -10
+9 -10
src/ast/container.rs
··· 183 183 "#" => { 184 184 // If the Gemtext line starts with an "#", it is a heading, so let's 185 185 // find out how deep it goes. 186 - let level = line.get(0..3).map_or(0, |root| { 187 - if root.contains("###") { 188 - 3 189 - } else if root.contains("##") { 190 - 2 191 - } else { 192 - // Converting the boolean response of `contains` to an integer 193 - usize::from(root.contains('#')) 194 - } 195 - }); 186 + let level = 187 + line.trim_start().chars().take_while(|&c| c == '#').count(); 188 + let level = if level > 0 189 + && line.chars().nth(level).map_or(true, char::is_whitespace) 190 + { 191 + level 192 + } else { 193 + 0 194 + }; 196 195 197 196 nodes.push(Node::Heading { 198 197 level,