Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Last row in markdown table renders centred #1868

Closed
FredHappyface opened this issue Jan 24, 2022 · 2 comments
Closed

[BUG] Last row in markdown table renders centred #1868

FredHappyface opened this issue Jan 24, 2022 · 2 comments

Comments

@FredHappyface
Copy link

You may find a solution to your problem in the docs or issues.

Thank you so much for this library! I tried implementing something similar and needless to say you do a far better job!

Describe the bug

When rendering a file that can be converted to markdown via pandoc

Github Markdown

Source file:
temp.md

Code snippet

markdown = Markdown(data)
console = Console()
console.print(markdown)

image

Here vscode does a decent job of printing the table

Markdown (Maybe commonmark?)

Source file:
temp.md

Code snippet

markdown = Markdown(data)
console = Console()
console.print(markdown)

image

Vscode has no clue what to do with this

Question

Whilst writing this issue I've learned that commonmark does not define a table format which is I find rather surprising. So the question is: what format do you expect a table to be in? And I'm curious what that's based on (eg. reading about gfm and liking how they do tables)

Platform

Click to expand

What platform (Win/Linux/Mac) are you running on? What terminal software are you using?

I may ask you to cut and paste the output of the following commands. It may save some time if you do it now.

python -m rich.diagnose
python -m rich._windows
pip freeze | grep rich
$ python -m rich.diagnose
╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface.                                                  │
│                                                                                  │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=120 ColorSystem.TRUECOLOR>                                    │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                  │
│     color_system = 'truecolor'                                                   │
│         encoding = 'utf-8'                                                       │
│             file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│           height = 30                                                            │
│    is_alt_screen = False                                                         │
│ is_dumb_terminal = False                                                         │
│   is_interactive = True                                                          │
│      is_terminal = True                                                          │
│   legacy_windows = False                                                         │
│         no_color = False                                                         │
│          options = ConsoleOptions(                                               │
│                        size=ConsoleDimensions(width=120, height=30),             │
│                        legacy_windows=False,                                     │
│                        min_width=1,                                              │
│                        max_width=120,                                            │
│                        is_terminal=True,                                         │
│                        encoding='utf-8',                                         │
│                        max_height=30,                                            │
│                        justify=None,                                             │
│                        overflow=None,                                            │
│                        no_wrap=False,                                            │
│                        highlight=None,                                           │
│                        markup=None,                                              │
│                        height=None                                               │
│                    )                                                             │
│            quiet = False                                                         │
│           record = False                                                         │
│         safe_box = True                                                          │
│             size = ConsoleDimensions(width=120, height=30)                       │
│        soft_wrap = False                                                         │
│           stderr = False                                                         │
│            style = None                                                          │
│         tab_size = 8                                                             │
│            width = 120                                                           │
╰──────────────────────────────────────────────────────────────────────────────────╯
$ python -m rich._windows
platform="Windows"
WindowsConsoleFeatures(vt=True, truecolor=True)
@willmcgugan
Copy link
Collaborator

Rich uses the commonmark library on PyPi, which doesn't support tables. At some point we will move to a more actively developed Markdown library which does support tables.

@github-actions
Copy link

Did I solve your problem?

Why not buy the devs a coffee to say thanks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants