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

LaTeX in EstimatorResult._repr_html_() is not rendered correctly #1958

Open
billti opened this issue Oct 10, 2024 · 1 comment
Open

LaTeX in EstimatorResult._repr_html_() is not rendered correctly #1958

billti opened this issue Oct 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@billti
Copy link
Member

billti commented Oct 10, 2024

In fixing #1880, I noticed that many of our notebooks (e.g. estimation-hardcoded-circuit, estimation-random-circuit and others) don't render resource estimation details using the widget, but just directly using a pattern such as:

result = qsharp.estimate("RunHardcodedCircuit()")
result

This shows a table where the markdown isn't rendered correctly even with the linked fix in place (as that only applies to widgets), e.g.

Image

In investigating the root cause for this, there are two issues to address:

Firstly, we have the below code in our pip package, but nothing in our docs or samples mentions requiring these packages, and no error or output is displayed to tell users to install them. We should document or provide output on this requirement if needed.

try:
    # Both markdown and mdx_math (from python-markdown-math) must be present for our markdown
    # rendering logic to work. If either is missing, we'll fall back to plain text.
    import markdown
    import mdx_math

    has_markdown = True
except ImportError:
    has_markdown = False

Secondly, even installing those packages didn't resolve the markdown rending in the table as shown in the screen shot above, so that needs to be fixed anyway.

CC @msoeken and @ivanbasov

@billti billti added bug Something isn't working needs triage labels Oct 10, 2024
@sezna
Copy link
Contributor

sezna commented Oct 14, 2024

One approach would be to move fully to widgets, which don't have this issue. If _repr_html() is to continue to be used, then there's a bug, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants