Bold/emphasis fails when closing delimiter is preceded by a closing bracket and followed by a non-punctuation character
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- markdown
- Ambito
- documentation
Direzione di ricerca
Start with CommonMark spec §6.2 and reproduce the examples using the GitHub Markdown API command in the issue. Compare the delimiter rules for closing punctuation against the listed expected and actual results. Done means reaching agreement on the proposed Unicode Pe rule and updating the relevant specification behavior and coverage.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Strong emphasis (bold) is not rendered when a ** closing delimiter is
immediately preceded by a closing bracket (e.g. ), ], ") and followed
by a non-punctuation, non-whitespace character such as a letter or digit.
Reproduction
Verified on GitHub.com via the Markdown API:
curl -s -X POST \
-H "Content-Type: application/json" \
-d '{"text": "**)**a\n", "mode": "gfm"}' \
https://api.github.com/markdown
# => <p>**)**a</p> ← not bold
| Input | Expected | Actual |
|---|---|---|
**)**a |
**)**a (bold) | **)**a (literal) |
**)**1 |
**)**1 (bold) | **)**1 (literal) |
**]**a |
**]**a (bold) | **]**a (literal) |
**"**a |
**"**a (bold) | **"**a (literal) |
**)**! |
)! (bold) | ✅ correct |
**)** a |
)·a (bold) |
✅ correct (with space) |
Root Cause
The CommonMark spec §6.2 defines a right-flanking delimiter run as:
(1) not preceded by Unicode whitespace, and
(2a) not preceded by a Unicode punctuation character, OR
(2b) preceded by a Unicode punctuation character AND followed by
Unicode whitespace or a Unicode punctuation character.
For **)**a, the closing ** has:
before=)→unicode.IsPunct= trueafter=a→ neither whitespace nor punctuation
Applying the rule:
!false && (!true || false || false) = false
→ The closing ** is not right-flanking → bold is not rendered.
Why this is a spec issue
Closing brackets (Unicode category Pe: ), ], }, ", », etc.)
are punctuation by Unicode definition, yet they are semantically
word-terminating — the character following them is logically separate
from the bracketed content. The current rule treats them the same as
opening punctuation like ( or ", which causes the asymmetry:
**(note)** is bold ✅ (after = space)
**(note)**. is bold ✅ (after = punctuation)
**(note)**a is NOT ❌ (after = letter)
This is counterintuitive: a user writing see **(RFC 9110)**section 5
would reasonably expect bold to apply.
Suggested fix
Amend condition (2b) to exclude closing punctuation (Unicode category Pe)
from the "preceded by punctuation" restriction:
(2b) preceded by a Unicode punctuation character other than a closing
bracket (category Pe), AND followed by Unicode whitespace or
a Unicode punctuation character.
Or equivalently: treat Unicode Pe characters as non-punctuation for the
purpose of the right-flanking delimiter rule only.
References
- CommonMark spec §6.2: https://spec.commonmark.org/0.31.2/#left-flanking-delimiter-run
- Unicode Pe (Close Punctuation): https://www.unicode.org/versions/Unicode15.0.0/ch04.pdf
- Lingua principale
- Python
- Stelle
- 5.2k
- Fork
- 360
- 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di commonmark/commonmark-spec
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
commonmark/commonmark-spec#843 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
commonmark/commonmark-spec#838 · 2 commenti ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
commonmark/commonmark-spec#728 · 2 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
commonmark/commonmark-spec#844 · 5 commenti · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
commonmark/commonmark-spec#842 ·
Tutte le issue di commonmark/commonmark-spec
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
[Bug]: Queen's own Ollama model loses num_ctx when a running session switches to itForse già presa @anasamin26 l’ha presa oggi. Apertabug enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aden-hive/hive#7508 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
llm translation
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
BerriAI/litellm#47884 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug 🐛
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
netalertx/NetAlertX#1856 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno