Find the byte position of the next paragraph break (\n\n or \r\n\r\n).
(text: &str)
| 249 | |
| 250 | /// Find the byte position of the next paragraph break (\n\n or \r\n\r\n). |
| 251 | fn find_paragraph_break(text: &str) -> Option<usize> { |
| 252 | // Check \r\n\r\n first (longer match). |
| 253 | if let Some(pos) = text.find("\r\n\r\n") { |
| 254 | let nn_pos = text.find("\n\n"); |
| 255 | // Return whichever comes first. |
| 256 | match nn_pos { |
| 257 | Some(nn) if nn < pos => Some(nn), |
| 258 | _ => Some(pos), |
| 259 | } |
| 260 | } else { |
| 261 | text.find("\n\n") |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | /// Build chunks from pre-split segments, respecting chunk_size and overlap. |
| 266 | /// |
no test coverage detected