refactor(chat_pipeline): improve regex patterns for table parsing
- Updated regex patterns for table separator and row matching to use [ \t] instead of \s, preventing newline consumption across rows. - Enhanced comments for clarity on the changes made to the regex expressions.main
parent
47397464ef
commit
649c9d3dc9
|
|
@ -452,9 +452,11 @@ var (
|
|||
// reLatexBlock matches block-level LaTeX ($$...$$).
|
||||
reLatexBlock = regexp.MustCompile(`(?s)\$\$.*?\$\$`)
|
||||
// reTableSep matches table separator rows like |---|---|.
|
||||
reTableSep = regexp.MustCompile(`(?m)^\s*\|[\s:|-]+\|\s*$`)
|
||||
// Uses [ \t] instead of \s to avoid consuming newlines across rows.
|
||||
reTableSep = regexp.MustCompile(`(?m)^[ \t]*\|[ \t:|-]+\|[ \t]*$`)
|
||||
// reTableRow matches markdown table data rows like | col1 | col2 |.
|
||||
reTableRow = regexp.MustCompile(`(?m)^\s*\|(.+?)\|\s*$`)
|
||||
// Uses [ \t] instead of \s to avoid consuming newlines across rows.
|
||||
reTableRow = regexp.MustCompile(`(?m)^[ \t]*\|(.+?)\|[ \t]*$`)
|
||||
// reHeadingPrefix matches leading # markers in headings.
|
||||
reHeadingPrefix = regexp.MustCompile(`(?m)^#{1,6}\s+`)
|
||||
// reBlockquote matches leading > markers.
|
||||
|
|
|
|||
Loading…
Reference in New Issue