fix: normalize open_tag whitespace in code block parser (#750)
This commit is contained in:
@@ -50,7 +50,11 @@ def normalize_code_block(match: re.Match) -> str:
|
||||
|
||||
normalized = "\n".join(lines)
|
||||
|
||||
return f"{open_tag}{normalized}\n{close_tag}"
|
||||
# Normalize open_tag: strip trailing whitespace/newlines, add single newline
|
||||
# The regex \s*\n can capture extra newlines in open_tag
|
||||
clean_open = open_tag.rstrip() + "\n"
|
||||
|
||||
return f"{clean_open}{normalized}\n{close_tag}"
|
||||
|
||||
|
||||
def process_line(line: str) -> tuple[str, int]:
|
||||
|
||||
Reference in New Issue
Block a user