Skip to content

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

@billti

Description

@billti

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions