diff --git a/rich/markdown.py b/rich/markdown.py index abbbb07d64..84a6408ef9 100644 --- a/rich/markdown.py +++ b/rich/markdown.py @@ -208,7 +208,9 @@ def __rich_console__( lines = console.render_lines(self.elements, render_options, style=self.style) style = self.style new_line = Segment("\n") - padding = Segment("▌ ", style) + quote_bar = "| " if options.legacy_windows or options.ascii_only else "▌ " + padding = Segment(quote_bar, style) + for line in lines: yield padding yield from line diff --git a/tests/test_markdown.py b/tests/test_markdown.py index c461c76966..7c4852fd1c 100644 --- a/tests/test_markdown.py +++ b/tests/test_markdown.py @@ -215,6 +215,20 @@ def test_inline_code_in_table_cells() -> None: assert result == expected +def test_markdown_blockquote_uses_safe_prefix_on_legacy_windows(): + console = Console( + width=40, + file=io.StringIO(), + color_system=None, + legacy_windows=True, + _environ={}, + ) + console.print(Markdown("> hello")) + output = console.file.getvalue() + assert "| hello" in output + assert "▌" not in output + + if __name__ == "__main__": markdown = Markdown(MARKDOWN) rendered = render(markdown)