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

Horizontal overflow of long math expressions with the --math flag #452

Closed
JCGoran opened this issue Nov 6, 2022 · 1 comment
Closed
Labels

Comments

@JCGoran
Copy link
Contributor

JCGoran commented Nov 6, 2022

Problem Description

This probably isn't as much of a bug, as it is my own lack of knowledge how to effectively use CSS, but I'm not sure where else to ask.
Anyway, the issue I'm having is that the default math generated by pdoc, if a bit lengthy, seems to overflow a bit on devices with narrow screen (notably mobile), i.e. it induces unnecessary horizontal scrolling.

Steps to reproduce the behavior:

  1. make a file mymodule.py with the following contents:
def my_function():
    r"""
    This method has some long math:
    $$
        \Delta = \Delta_\text{galaxy} + \Delta_\text{RSD} + \Delta_\text{lensing} + \Delta_\text{Doppler} + \Delta_\text{potential}
    $$
    """
    return
  1. run pdoc --math mymodule
  2. notice the result has horizontal scrolling (i.e. the math overflows):
    image

I think the fix should be something like:

.MathJax_Display, .MJXc-display, .MathJax_SVG_Display {
    overflow-x: auto;
    overflow-y: hidden;
}

but I'm not entirely sure how to include it properly in the Jinja2 template (I've looked at #319 but I can't get it to work :(), so any help would be appreciated.

System Information

pdoc: 12.2.0
Python: 3.9.13
Platform: Linux-5.16.0-1-amd64-x86_64-with-glibc2.35
@JCGoran JCGoran added the bug label Nov 6, 2022
@JCGoran JCGoran changed the title Horizontal overflow of long math expression with the --math flag Horizontal overflow of long math expressions with the --math flag Nov 6, 2022
mhils added a commit to mhils/pdoc that referenced this issue Nov 10, 2022
@mhils
Copy link
Member

mhils commented Nov 10, 2022

Thanks for the report! Fixed in #456.

@mhils mhils closed this as completed in 701e77d Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants