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

Markdown table alignment stopped working #3919

Closed
waynebliu opened this issue Sep 14, 2018 · 7 comments · Fixed by #4130
Closed

Markdown table alignment stopped working #3919

waynebliu opened this issue Sep 14, 2018 · 7 comments · Fixed by #4130

Comments

@waynebliu
Copy link

col1 col2 col3
left aligned right aligned centered
A A A

In Jupyter, now it's always right aligned!

It's one thing enforce right-alignment for consistency reasons as described in /pull/2534. It's another to stop supporting features in Markdown as described by the link in the Help bar, currently pointing to:

https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/
https://help.github.com/articles/organizing-information-with-tables/#formatting-content-within-your-table

Furthermore, the user gets no messaging to let them know that they're using unsupported features, i.e. the :---, :---:, and ---: tokens to describe justification.

@ian-r-rose
Copy link
Member

I believe this is a bug in marked+GFM: they are using obsolete HTML align attributes instead of CSS, and those are very low precedence. See also a possible fix + discussion in jupyterlab/jupyterlab#5301

@baer95
Copy link

baer95 commented Oct 20, 2018

I'm not sure I understand what the current status on table alignment is in jupyter notebook... so please correct me if something is wrong. Also I commented here since this is the issue with the most recent activity about the not-working markdown table alignment.

There is an effort to keep feature parity with the jupyterlab, which stops the Jupyter notebook from switching from marked to a different markdown renderer.
And the default for table alignment should be right-align, which also makes sense when working with numbers.
But marked uses the html align attribute (to be GFM-compliant) for custom alignment when using :-, :-: or --: which gets overridden by the right-align default which is defined in css?

Is there an intention to support custom table alignment this in the future?

And as I understand it, there is the option of extending marked with a custom renderer in order to get custom alignment working?

Another possible way to achieve this was given in the marked-issue where they discussed GFM-compliance: markedjs/marked#1211 (comment)
Would introducing such a line lead to Jupyter notebook not being on par with jupyterlab or is this a possible way to go?

Thank you for your clarifications!

@jasongrout
Copy link
Member

There is an effort to keep feature parity with the jupyterlab, which stops the Jupyter notebook from switching from marked to a different markdown renderer.

Here's a partial answer in the time I have right now. It's the other way around: JLab is keeping parity with the notebook, which prevents JupyterLab from switching to a different markdown renderer (if the notebook switched, lab would most likely do the same). But the bigger issue is that in reality, both the notebook and lab are keeping parity with the user expectations for millions of existing notebooks, which makes it hard for either to switch.

@nealmcb
Copy link

nealmcb commented Dec 3, 2018

Thanks, @ian-r-rose for your note above

See also a possible fix + discussion in jupyterlab/jupyterlab#5301

Has anyone looked to see if that approach from JupyterLab would resolve this issue for Jupyter Notebook?

@SpencerPark
Copy link
Contributor

@nealmcb I have a PR open that fixes this issue. It is not the same approach because the notebook was not broken in the same way that jupyterlab was. It completely omitted the alignment in the rendered output.

The fix is essentially a patch to marked to use style instead of align (in the same way it was being blocked before but this time it modifies instead of removing the output) which takes precedence over a CSS default allowing jupyter to give the default of right alignment in CSS but markdown tables to override it if an alignment is specifically set. See #4130.

@jkpubsrc
Copy link

jkpubsrc commented May 15, 2019

This bug has been filed eight months ago and patched six months ago. When will this fix be available in a release? The most recent stable version does not contain this fix.

@qris
Copy link

qris commented Feb 2, 2021

This bug has been filed eight months ago and patched six months ago. When will this fix be available in a release? The most recent stable version does not contain this fix.

All versions of 6.0.0+ appear to include the fix.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants