Skip to content

How to use numref for tables generated in code-cells? #1190

Closed Answered by cnjr2
cnjr2 asked this question in Q&A
Discussion options

You must be logged in to vote

This is ultimately my workaround for this:

```{code-cell} python
---
tags: [remove-input]
mystnb:
  markdown_format: myst
---
from IPython.display import display, Markdown
import pandas as pd

display(
  Markdown(
    "\n".join(
      [
        "```{table} This is markdown table with caption.",
        ":name: markdown_table",
        # ":width: 50%",
        pd.DataFrame({"x": [1, 2, 3, 4], "y": [5, 2, 7, 9]}).to_markdown(),
        "```"
      ]
    )
  )
)
```

I think the option below would be nice as it would align with the figures:

```{code-cell} python
---
mystnb:
  table:
    caption: This is markdown table with caption.
    caption_before: True
    name: markdown_table
---
import…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by cnjr2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant