From 7aa12c170d2a979763c6a80dc0b320b6d9186a1e Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L. de Mello" Date: Tue, 2 Apr 2024 12:34:26 -0300 Subject: [PATCH] fix: uncommited function --- src/utils.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils.rs b/src/utils.rs index fa6beab..cc63edd 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -60,3 +60,13 @@ where } None } +pub fn extract_text<'a>(node: &'a comrak::nodes::AstNode<'a>) -> String { + let text = RefCell::new(String::new()); + let _ = iter_nodes(node, &|node| { + if let NodeValue::Text(t) = &node.data.borrow().value { + text.borrow_mut().push_str(&t); + } + }); + let r = text.borrow().to_string(); + r +}