How can I prevent html code from displaying above pandas tables in quarto reports of format: gfm?

When I display a pandas table in a quarto gfm report I see html code above the table when I view the report in github. How can I prevent this?

All code from .qmd file that created above report

---
title: 'HTML junk'
author: 'Joseph Powers'
date: 2024-03-14
format: gfm
---

```{python}
import numpy as np
import pandas as pd
```

# Notice the html code above the table
```{python}
N = int(5e3)
TRIALS = int(1)

pd.DataFrame(
    {
        "A": np.random.binomial(TRIALS,  0.65, N),
        "B": np.random.binomial(TRIALS,  0.65, N),
        "C": np.random.binomial(TRIALS,  0.65, N),
        "D": np.random.binomial(TRIALS,  0.67, N)
    }
)
```

I can't replicate this on MacOS 12.3.1 and Quarto 1.4.551.

Everything is printing as intended.

---
format: gfm
---

```{python}
import numpy as np
import pandas as pd
```

```{python}
N = int(5e3)
TRIALS = int(1)

pd.DataFrame(
    {
        "A": np.random.binomial(TRIALS,  0.65, N),
        "B": np.random.binomial(TRIALS,  0.65, N),
        "C": np.random.binomial(TRIALS,  0.65, N),
        "D": np.random.binomial(TRIALS,  0.67, N)
    }
)
```

What Quarto version are you using? Did you use any particular chunk attributes?

The report looks fine when previewed locally, but when pushed and viewed in GitHub the html is visible.

MacOS Sonoma 14.3.1 and Quarto 1.4.537.

Ah yeah my bad, I read too quickly and missed the GitHub part. This is the normal behavior because GitHub sanitizes the HTML before rendering it to prevent malicious code from being executed.

I don't think there's a way to stop Quarto from generating the style but maybe someone has a solution. In the meantime you can safely remove the <style></style> tags from the .md file although it will be added every time your render your document.

I think this discussion could be off interest

The <style> is added by Pandas output representation, but this is not compatible with Github Markdown.

You would need to customize the output of your Pandas DataFrame

Hope this helps