mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-01-29 15:38:01 -05:00
fix(removeContentTags): keep newlines to preserve formatting
The space normalization logic is updated to replace only multiple spaces and tabs with a single space, while preserving newlines. This change ensures that the formatting of the content is maintained, especially when dealing with empty line requirements and max line length.
This commit is contained in:
@@ -43,9 +43,9 @@ export function removeContentTags<T extends string | null | undefined>(content:
|
||||
result += content[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Normalize spaces (replace multiple spaces with a single space)
|
||||
result = result.replace(/\s+/g, ' ').trim();
|
||||
|
||||
|
||||
// Normalize multiple spaces/tabs into a single space (preserves newlines), then trim.
|
||||
result = result.replace(/[ \t]+/g, ' ').trim();
|
||||
|
||||
return result as unknown as T;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user