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

Tables from code-output not properly rendered #570

Open
raphaelquast opened this issue Nov 20, 2023 · 3 comments
Open

Tables from code-output not properly rendered #570

raphaelquast opened this issue Nov 20, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@raphaelquast
Copy link

Describe the bug

context
I have a nice markdown table like this:

| a | b | c |
|---|---|---|
| 1 | 2 | 3 |

and I'd like to render it from a code-cell using something like this:

from IPython.display import display, Markdown
display(Markdown(
"""
| a | b | c |
|---|---|---|
| 1 | 2 | 3 |
"""
))

... and in my conf.py i have the following:

myst_render_markdown_format = "myst"

expectation
I expected something like this:

image

bug
But instead I get this:

image

Reproduce the bug

the description should be enough to reproduce

List your environment

myst-nb 1.0.0
myst-parser 2.0.0

@raphaelquast raphaelquast added the bug Something isn't working label Nov 20, 2023
Copy link

welcome bot commented Nov 20, 2023

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@mathisdrn
Copy link

mathisdrn commented Feb 11, 2024

I was also trying to render a dataframe into a proper markdown table and I was able to reproduce bug.
This is inconvenient as mystnb should help to format table with data instead of having to write markdown.

@raphaelquast
Copy link
Author

@mathisdrn
fyi: I found that HTML tables seem to do the job just fine (and pandas supports html-table output as well... )!

import pandas as pd
from IPython.display import display, Markdown
df = pd.DataFrame(dict(a=[1,2,3], b=[4,5,6]))

display(HTML(df.to_html()))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants