MyST-Parser icon indicating copy to clipboard operation
MyST-Parser copied to clipboard

Table cell alignment classes are incompatible with bootstrap 5

Open jhcole opened this issue 1 year ago • 5 comments

The "left" and "right" cell alignment options are handled by assigning text-left or text-right classes to the cell. I think this approach was relying on the styling of these classes in bootstrap, but bootstrap 5 removed these classes and replaced them with text-start and text-end. I'm guessing this was done to support right-to-left languages. The problem is currently visible in the MyST parser documentation.

image.

For a Jupyter book, I've worked around the issue by adding

sphinx:
  config:
    html_static_path: ["_static"]
    html_css_files: ["custom.css"]

to _config.yml, and then adding

.text-left{
  text-align: left !important;
}
.text-right{
  text-align: right !important;
}

to _static/custom.css.

jhcole avatar Jun 24 '23 21:06 jhcole

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
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! :tada:

welcome[bot] avatar Jun 24 '23 21:06 welcome[bot]

Heya, myst-parser does not provide any CSS stylings, this is up to the html theme used.

This is in an issue that needs to be raised with sphinx-book-theme.

chrisjsewell avatar Jun 26 '23 07:06 chrisjsewell

This is discussed in the "Aligning cells in Sphinx HTML themes" drop-down and, for example, is specifically accounted for in https://github.com/pradyunsg/furo/blob/80afa27a9a7bd0ac9259636239e349656c4726ab/src/furo/assets/styles/content/_tables.sass#L36

chrisjsewell avatar Jun 26 '23 11:06 chrisjsewell

Heya, myst-parser does not provide any CSS stylings, this is up to the html theme used.

This is in an issue that needs to be raised with sphinx-book-theme.

Thanks for letting me know. I'll reraise the issue or submit a pull request there.

The MyST Parser is applying the class names text-left and text-right, and I'm wondering if those names are still the best choice. Bootstrap 3 and 4 included them, but 5 does not.

jhcole avatar Jun 27 '23 21:06 jhcole

Heya, myst-parser does not provide any CSS stylings, this is up to the html theme used.

This is in an issue that needs to be raised with sphinx-book-theme.

Same trouble with PyData Shinx Theme.

dbitouze avatar Oct 10 '23 19:10 dbitouze