NodeBB / NodeBB/nodebb-plugin-markdown

Spurious {1} inserted into autodetect code highlighting when numbering enabled.

Aperta
#167 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
JavaScript
Stelle
33
Fork
41
Merge medio
3h 40m
PR unite (30g)
4

Descrizione

There is a bug where specific words in a code block set to use line numbering will cause some empty following lines to have spurious {1} text inserted in it. e.g.:
image

this can be confirmed by inspecting the <code class> element it will be set to hljs sql for blocks with this issue and hljs perl or other wise for blocks of code without this issue.

This only happens if the code language is autodetected as SQL (hence why the specific words are needed to trigger the highlight.js autodetection for SQL). if the language type is set to SQL or any other type it does not happen:

image

If line numbering for SQL is turned off in the markdown plugin settings it does not happen:
image
(note no line numbering, no {1})

So we can work around this issue by just not having line numbering for SQL as we don't post SQL frequently/at all on our forum.

Versions:

NodeBB version: 1.18.5 (although we have had this issue from at least 1.16)
Markdown plugin version: 8.14.4

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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.

Direzione di ricerca

Inizia riproducendo il problema nel plugin Markdown con un blocco di codice SQL rilevato automaticamente e la numerazione delle righe abilitata, quindi esamina l’integrazione dell’evidenziazione del codice e della numerazione delle righe. Il lavoro è completato quando il rilevamento automatico di SQL non inserisce più testo spurio {1} nelle righe vuote successive, mentre l’evidenziazione esplicita di SQL e gli altri linguaggi rimangono invariati.

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

Valutazione

Stack tecnologico
javascript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.