Surrogate & grapheme
JS
closed
markdown-it smart quotes break around non-BMP (U+10000+) characters
fix: handle non-BMP punctuation and symbols in smart quotes
markdown-it · markdown-it/markdown-it
Symptom
markdown-it's smart quotes replacement does not handle non-BMP punctuation and symbols (U+10000+); surrounding text with supplementary characters causes wrong quote pairing or no conversion.
Minimal repro
markdown-it smartquotes on text adjacent to emoji or supplementary Unicode symbols (e.g., '𝕳ello'); smart quote pairing is incorrect.
Fix
Use a regex that is Unicode-aware for the 'whitespace' and 'punctuation' character class checks, or use Array.from for code-point iteration.