Skip to content

Commit

Permalink
remove extra condition by regex change
Browse files Browse the repository at this point in the history
  • Loading branch information
yggverse committed Dec 3, 2024
1 parent facb90d commit f08ae77
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/line/code/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,15 @@ impl Inline {
pub fn from(line: &str) -> Option<Self> {
// Parse line
let regex = Regex::split_simple(
r"^`{3}([^`]*)`{3}$",
r"^`{3}([^`]+)`{3}$",
line,
RegexCompileFlags::DEFAULT,
RegexMatchFlags::DEFAULT,
);

// Extract formatted value
let value = regex.get(1)?.trim();

if value.is_empty() {
return None;
}

// Result
Some(Self {
value: value.to_string(),
value: regex.get(1)?.trim().to_string(),
})
}
}

0 comments on commit f08ae77

Please sign in to comment.