Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

CSV fields are interpreted as console markup, changing data or aborting rendering

Aperta Adatta ai principianti
#147 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@ac1982 ci sta già lavorando.

Dal 15/10/2026.

  • #150 di @ac1982 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Inizia da render_csv() in src/rich_cli/main.py, dove le stringhe grezze vengono passate a Table.add_column() e Table.add_row(). Esegui i due comandi printf della issue per vedere il markup venire consumato e il codice di uscita 255. Il lavoro è completo quando i valori CSV tra parentesi quadre, come [red]literal[/red] e [/bold], vengono mostrati come testo letterale e il comando termina con 0.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

CSV cells containing bracketed text are passed through Rich markup parsing. Valid CSV data can therefore disappear or abort the command rather than render literally.

Environment
  • rich-cli distribution 1.8.1, default-branch commit 46f4d2469097be395558768714a5f07ebccf1412
  • Rich 12.6.0, Click 8.5.0
  • Linux x86_64, Python 3.10.12
Reproduction
printf 'name,value\n[red]literal[/red],2\n' | rich --csv -
printf 'name,value\n[/bold],2\n' | rich --csv -
echo "exit=$?"

I also reproduced the first case from a .csv file and inspected its SVG export.

Actual behavior

The first table shows only literal, in red. The actual CSV value [red]literal[/red] is changed, even though this is CSV mode, not --print mode.

The second command fails with:

failed to print resource: closing tag '[/bold]' at position 0 doesn't match any
open tag
exit=255

A standalone field [not-a-style] also renders as an empty cell.

Expected behavior

CSV header and data values should render as literal text. Brackets and strings resembling markup should not remove data or cause a valid CSV to fail.

Cause

render_csv() in src/rich_cli/__main__.py passes raw strings to Table.add_column() and Table.add_row(). Rich's table/console path interprets those strings as markup. Wrapping the values in Text or escaping them before handing them to the table would keep the cells literal.

These commands were run locally with the versions above. This is separate from empty-CSV handling in #143 and delimiter detection: both fixtures parse into ordinary two-column CSV rows.

Lingua principale
Python
Stelle
3.8k
Fork
125
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Textualize/rich-cli

Tutte le issue di Textualize/rich-cli

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.