We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
starts_with
1 parent cd68acc commit 223d046Copy full SHA for 223d046
crates/rust-project-goals/src/markwaydown.rs
@@ -163,8 +163,10 @@ fn categorize_line(line: &str) -> CategorizeLine {
163
if line.starts_with('#') {
164
let level = line.chars().take_while(|&ch| ch == '#').count();
165
CategorizeLine::Title(level, line.trim_start_matches('#').trim().to_string())
166
- } else if line.starts_with('|') && line.ends_with('|') {
167
- let line = &line[1..line.len() - 1];
+ } else if let Some(line) = line
+ .strip_prefix('|')
168
+ .and_then(|line| line.strip_suffix('|'))
169
+ {
170
let columns = line.split('|').map(|s| s.trim());
171
if columns.clone().all(|s| s.chars().all(|c| c == '-')) {
172
CategorizeLine::TableDashRow(columns.count())
0 commit comments