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

Render tables in Markdown code outputs #322

Closed
updiversity opened this issue May 4, 2021 · 4 comments
Closed

Render tables in Markdown code outputs #322

updiversity opened this issue May 4, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@updiversity
Copy link

Describe the bug

While the table is properly displayed in Jupyter, but as well when using nbsphinx, it is not displayed properly when using myst-nb. Actually in this case, it shows simply the input string.

Please note the option myst_commonmark_only=True was set.

To Reproduce

from IPython.display import display, Markdown
display(Markdown(
    '| name                       | description   | formula   |\n|:---------------------------|:--------------|:-------|\n| blablabla              | blablabla     | $\hat p - p$      |\n| badaboum | badaboum      | $\hat p - p$      |'
))

Expected behavior

by using myst-nb sphinx plugin, the table should be properly exported and the mathjax formulas should be properly displayed.

@updiversity updiversity added the bug Something isn't working label May 4, 2021
@welcome
Copy link

welcome bot commented May 4, 2021

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! 🎉

@chrisjsewell
Copy link
Member

Heya, thanks for the feedback

Please note the option myst_commonmark_only=True was set.

Just to note, tables are not actually part of the CommonMark specification and so won't be rendered with this option.
But anyhow, currently Markdown code cell outputs are hard-coded to be rendered with commonmark_only and so tables will not be rendered.
It's a known "issue", and certainly something I will be addressing in the not too distant future

@chrisjsewell chrisjsewell added enhancement New feature or request and removed bug Something isn't working labels May 4, 2021
@chrisjsewell chrisjsewell changed the title Markdown table not exported properly Render tables in Markdown code outputs May 4, 2021
@tsalo
Copy link

tsalo commented Apr 5, 2022

I believe that I just experienced this issue as well. Is there any kind of workaround in place for rendering markdown tables from code cells?

@chrisjsewell
Copy link
Member

Heya, after #380 (release pending) you can now set nb_render_markdown_format = "gfm" or nb_render_markdown_format = "myst", to configure how markdown outputs are rendered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants