async def test_newline_handling(self):
        """Test handling of empty and whitespace-only lines."""
        test_cases = {
            "Line 1\n\nLine 2": "Line 1\n Line 2",  # Empty line becomes space
            "Line 1\n   \nLine 2": "Line 1\n Line 2",  # Whitespace line becomes single space
            "Text\n\n\nMore": "Text\n More",  # Multiple empty lines become spaces
        }

        for input_text, expected in test_cases.items():
            result = await self.filter.filter(input_text)
            self.assertEqual(
                result, expected, f"Newline handling failed for:\n{input_text}\nGot:\n{result}"
            )
Test handling of empty and whitespace-only lines.
tests/test_markdown_text_filter.py