How to keep every row the same width #3955
Answered
by
murriiii
walkinrain2008
asked this question in
Q&A
result is i wish like : |
Answered by
murriiii
Feb 9, 2026
Replies: 1 comment 6 replies
|
The issue is that To get consistent-width output that wraps at exactly Option 1: Build the string yourself and let Rich wrap itfrom rich.console import Console
from rich.text import Text
con = Console(width=20, record=True)
s = "a" * 25
con.print(s)
# Build the full string, then print it as a single unit
parts = ",".join(["b" * 5 for _ in range(10)]) + ","
con.print(Text(parts, overflow="fold"))The Option 2: Use
|
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ah i see, so u cant change the print calls bc they come from other scripts — makes sense. two options that work without touching the print code:
option 1: CSS via
code_format— let the browser handle wrapping:option 2: re-record with fold — post-process the recorded text before exporting: