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

Table cell alignment classes are incompatible with bootstrap 5 #785

Open
jhcole opened this issue Jun 24, 2023 · 5 comments
Open

Table cell alignment classes are incompatible with bootstrap 5 #785

jhcole opened this issue Jun 24, 2023 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@jhcole
Copy link
Contributor

jhcole commented Jun 24, 2023

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.

@welcome
Copy link

welcome bot commented Jun 24, 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! 🎉

@chrisjsewell
Copy link
Member

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 chrisjsewell added the documentation Improvements or additions to documentation label Jun 26, 2023
@chrisjsewell
Copy link
Member

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

@jhcole
Copy link
Contributor Author

jhcole commented Jun 27, 2023

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 added a commit to Purdue-ECE-32300/lab_book that referenced this issue Jul 14, 2023
- Adds custom CSS for `text-left` and `text-right` classes.  These are
  added to table cells by MyST parser but are not defined in Boostrap 5.
  [issue](executablebooks/MyST-Parser#785)

- Converts the post-lab model parameters table from a list-table to a
  regular table because list-tables do not support column alignment.

- Replaces the deprecated \si command with \qty.  Hopefully this will
  help with compatibility with the LaTeX siunitx package.
@dbitouze
Copy link

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.

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

No branches or pull requests

3 participants