Skip to content

Conversation

jpfeuffer
Copy link

@jpfeuffer jpfeuffer commented Apr 1, 2025

Hi!

Thanks for the neat plugin.
Unfortunately it does not support labels for referencing the outputs of qmd code blocks.
I started on at least ignoring the labels and saving them in the Block class.

Would be cool if we could generate an anchor for the admonition (or at least inside of it), to make it referencable with the default markdown reference syntax at least. Note this is not done yet.

My test:

---
title: "demo"
format:
  html:
    code-fold: true
jupyter: python3
---

For a demonstration of a line plot on a polar axis, see [here](#example-figure).
Test `{python} "hello " + str(4+5)`.

```{python}
#| echo: true
#| label: example-figure
#| tbl-cap: "dataframe" 
import pandas as pd

df = pd.DataFrame({
    "a": [1, 2, 3],
    "b": [100, 200, 300],
    "c": [0.01, 0.05, 0.001]
})
df
```

Sorry for the mix of topics and figure/tables 😄 was testing a lot of stuff. Can make it cleaner soon.

@jpfeuffer
Copy link
Author

jpfeuffer commented Apr 1, 2025

Now it also supports writing the label as id to the div.

I saw that for actual figures this is not necessary since quarto will add the label into the correct markdown figure.

@jspaezp
Copy link
Owner

jspaezp commented Jun 30, 2025

shoot I cannot believe I missed this guy! so sorry about that!

Copy link
Owner

@jspaezp jspaezp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can give it a closer look but I would really appreciate if the test file was added to the unit tests!

@@ -358,8 +372,16 @@ def _into_output_lines_cell_elem(self, file_content: FileContent) -> list[str]:
# markdown in html attribute and leave as is.
non_empty = [line for line in internal if line.strip()]
if internal[0].startswith("<div>") and non_empty[-1].endswith("</div>"):
print("FOO")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove these lines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants