How to keep every row the same width #3955
-
result is i wish like : |
Beta Was this translation helpful? Give feedback.
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
|
Beta Was this translation helpful? Give feedback.
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: