pandas DataFrame output keeps its `border="1"` and scoped `<style>`, and gets no Bootstrap table classes
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 57/100
Línea de trabajo
Start with bootstrapHtmlPostprocessor in src/format/html/format-html-bootstrap.ts and compare its handling of parsed tables with TableBootstrapClassTransform, which currently handles Markdown tables. Reproduce with the supplied pandas DataFrame example using html-table-processing: none, then inspect the raw HTML output. Done means the raw table receives the Bootstrap classes and loses the border, preceding scoped style, and row alignment style, matching the expected output.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
This issue was written by Claude while adding q2 support to
Great Docs. The output shown comes from running each repro.
Bug description
A pandas DataFrame's HTML output is a <table border="1" class="dataframe">. It comes after a
<style scoped> element that right-aligns the header, and its header row has
style="text-align: right;". Quarto 1 tidies this table in its Bootstrap HTML post-processor
(bootstrapHtmlPostprocessor in src/format/html/format-html-bootstrap.ts, around line 476):
- it removes
border, the rows'styleand the<style>just before the table; - it adds
table table-sm table-striped small.
It does the same for R's table.data-frame, adding only the classes. So a DataFrame looks like
any other table on the page.
q2 writes the table as pandas wrote it. The browser draws a 1px border round every cell, with no
cell padding, and right-aligns the header. That's the default look of an HTML table, not a
Bootstrap one. q2's TableBootstrapClassTransform gives Bootstrap classes only to Markdown tables
(Block::Table), and this table is raw HTML.
By default, Quarto 1 parses the table into a Markdown table first (html-table-processing), and
then adds the same classes to it. q2 has no HTML reader, so it can't. Sites that set
html-table-processing: none take the post-processor path above; Great Docs does, for Great
Tables output. q2 leaves the table raw either way.
Great Docs now does the post-processor's cleanup itself in q2 builds, in a post-render script.
Steps to reproduce
mkdir dataframe && cd dataframe
cat > page.qmd <<'QMD'
---
title: DataFrame output
html-table-processing: none
---
```{python}
import pandas as pd
pd.DataFrame({"x": [1, 2, 3], "y": [4, 5, 6]})
```
QMD
q2 render page.qmd
grep -B14 -A3 '<table' page.html
Actual behavior
With q2 0.47.0, and with the nightly 0.48.0-nightly.20261125:
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
Without html-table-processing: none, the table is the same: <table border="1" class="dataframe">.
Expected behavior
As in Quarto 1.9.37:
<div>
<table class="dataframe table table-sm table-striped small">
<thead>
<tr>
<th></th>
Without html-table-processing: none, Quarto 1 writes <table class="dataframe caption-top table table-sm table-striped small" data-border="1">, from the parsed table.
- Lenguaje dominante
- Rust
- Estrellas
- 316
- Forks
- 23
- Merge medio
- 11 h 49 min
- PR fusionados (30 d)
- 245
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de quarto-dev/q2
-
Heading anchor links have no icon: AnchorJS is initialised with an empty `icon`Posiblemente ocupada @cscheid la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
quarto-dev/q2#1419 ·
Los mantenedores suelen responder en 1 día
-
bug testing windows
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
quarto-dev/q2#1346 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
quarto-dev/q2#1095 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 67/100
quarto-dev/q2#1418 ·
Los mantenedores suelen responder en 1 día
-
bug readers-writers windows
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
quarto-dev/q2#1416 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de quarto-dev/q2
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
BurntSushi/jiff#755 ·
Los mantenedores suelen responder en 1 día
-
After the kernel is given up on, a new import leaves "Importing…" and its Cancel on the status lineAbiertobug help wanted priority: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
sawhorse3d/sawhorse#163 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
MartinPTielemans/ilo#4607 ·