-
Notifications
You must be signed in to change notification settings - Fork 235
DOC: Generate the charset tables dynamically from codes #3409
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
Conversation
| from pygmt.encodings import charset | ||
| def get_charset_mdtable(name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is modified from the original script at #3206 (comment)
doc/conf.py
Outdated
| # MyST-NB configurations: https://myst-nb.readthedocs.io/en/latest/configuration.html | ||
| nb_render_markdown_format = "myst" # The format to use for text/markdown rendering | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value is 'commonmark', which doesn't support tables.
| max-width: 80%!important; | ||
| } | ||
|
|
||
| /* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the CSS styles from myst-nb.
div.cell_output tr,
div.cell_output th,
div.cell_output td {
text-align: right;
vertical-align: middle;
padding: 0.5em 0.5em;
line-height: normal;
white-space: normal;
max-width: none;
border: none;
}
The text-align is set to right, which makes sense for displaying objects like pandas.DataFrame (an example at https://myst-nb.readthedocs.io/en/latest/render/format_code_cells.html#remove-stdout-or-stderr).
In MyST, the table cell alignment can be controlled using : characters (https://myst-parser.readthedocs.io/en/latest/syntax/tables.html), which is done by assigning text-left/text-center/text-right to cells. These CSS classes are not defined in Sphinx_rtd_theme, so we have to define them here.
Description of proposed changes
After adding the
myst-nbextension in #3379, it's possible to generate the charset tables dynamically from codes.Preview:
Pros:
Cons: