9001 / 9001/copyparty

Rendered Markdown discards hard TABs

Aperta
#1,368 1 commento 0 reazioni 1 assegnatario Rivendicata da @9001 Vedi su GitHub
bug
Lingua principale
Python
Stelle
46.7k
Fork
1.9k
Merge medio
9g 2h
PR unite (30g)
4

Descrizione

### Describe the bug(?)
When creating a Markdown file that uses hard TABs (0x9) in code blocks instead of spaces, the Markdown renderer forcibly coerces them to four spaces.

### To Reproduce
Create a Markdown file, and add a code block with tabs in it.

```markdown
ˋˋˋc
int main() {
return 0;
}
ˋˋˋ
```

Here, GitHub appears to keep the TABs intact. This is what I expect from the Copyparty client, but this does not seem to happen.

### Expected behavior
The renderer shouldn't mangle the text, and should just leave the TABs as-is, including them inside of code blocks as just the TAB character by itself.

The `tab-size` CSS property is already widely supported across all major browsers and getting Stylus or similar to create a global style that sets this property to `8`, `4`, `2`, or similar on all websites is trivial. Expanding them into spaces when rendering defeats the purpose of using TABs and is a pretty useless "feature". It is bound to mess with the layout of some text files, especially TSV files.

A better way to deal with this would be to just keep them as TABs and allow the user to change this `tab-size` property themself, or make it a configuration option on the client.

### Screenshots
Image

### Client details
* OS version: NixOS 25.05
* browser version: Firefox 145

### Additional context
I understand that hard TABs vs spaces are a rather contentious issue and it may be easier to take the opinionated route and leave this as it is now, but fixing it instead of disregarding it as intentional would hurt nobody. Many people use spaces because they are happy with it, and they will never take issue with TABs being rendered verbatim... why would they?

This may be an issue with some Markdown renderer upstream if this project uses one, but I'm not sure if it does (and *if* it does, I wouldn't be surprised if there's some configuration option not being passed to it that would allow this behavior to happen as expected).

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Individua il codice di rendering di Markdown nel progetto, probabilmente usando una libreria come mistune o markdown2. Controlla le opzioni di configurazione per preservare le tabulazioni nei blocchi di codice. Cerca la gestione di tab-size da parte di CSS. Verifica le modifiche creando un file Markdown con tabulazioni e controllando l’output renderizzato nel browser.

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

Valutazione

Stack tecnologico
markdown, python
Ambito
content, frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.