Newline between group items in table cell #3603
-
Coming from #1951, I tried the following: from rich import print
from rich.console import Group
from rich.markdown import Markdown
from rich.padding import Padding
from rich.table import Table
from rich.text import Text
table = Table(box=None, expand=False)
table.add_column(justify="left", ratio=1)
table.add_column(ratio=2)
table.add_row(
Text("Global options", justify="left"),
Text(),
)
table.add_row(
Padding("[-c, --config CONFIG]", (0, 0, 0, 2)),
Group(
Text("Path to the configuration file."),
Markdown(
"Default: `~/.config/project/project.toml`.",
style="dim italic",
),
fit=True,
),
)
print(table) Output:
I was expecting:
I tried using |
Beta Was this translation helpful? Give feedback.
Answered by
willmcgugan
Jan 6, 2025
Replies: 1 comment 7 replies
-
Markdown will use up the available width. Why combine your text with the Markdown? If you don't want to do that, you could replace the Group with another Table. |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
pawamoy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Markdown will use up the available width. Why combine your text with the Markdown?
If you don't want to do that, you could replace the Group with another Table.