@inceptionstack/roundhouse 0.3.24 → 0.3.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/telegram-format.ts +7 -6
package/package.json
CHANGED
package/src/telegram-format.ts
CHANGED
|
@@ -133,11 +133,12 @@ function formatTable(tableMd: string): string {
|
|
|
133
133
|
if (cp >= 0xFE00 && cp <= 0xFE0F) return 0;
|
|
134
134
|
// Tags block (used in flag sequences etc)
|
|
135
135
|
if (cp >= 0xE0001 && cp <= 0xE007F) return 0;
|
|
136
|
-
// Emoji —
|
|
137
|
-
|
|
138
|
-
if (cp >=
|
|
139
|
-
if (cp >=
|
|
140
|
-
if (cp >=
|
|
136
|
+
// Emoji — standard 2-column width (Telegram renders slightly wider but
|
|
137
|
+
// fractional widths can't be fixed with integer padding; 2 is closest)
|
|
138
|
+
if (cp >= 0x1F100 && cp <= 0x1FAFF) return 2;
|
|
139
|
+
if (cp >= 0x231A && cp <= 0x23FF) return 2;
|
|
140
|
+
if (cp >= 0x2600 && cp <= 0x27BF) return 2;
|
|
141
|
+
if (cp >= 0x2B50 && cp <= 0x2B55) return 2;
|
|
141
142
|
// CJK Unified Ideographs
|
|
142
143
|
if (cp >= 0x3400 && cp <= 0x4DBF) return 2;
|
|
143
144
|
if (cp >= 0x4E00 && cp <= 0x9FFF) return 2;
|
|
@@ -155,7 +156,7 @@ function formatTable(tableMd: string): string {
|
|
|
155
156
|
const segmenter = new Intl.Segmenter();
|
|
156
157
|
const graphemeDisplayWidth = (grapheme: string): number => {
|
|
157
158
|
// ZWJ emoji sequences: multiple code points but render as a single wide emoji
|
|
158
|
-
if (grapheme.includes('\u200D')) return
|
|
159
|
+
if (grapheme.includes('\u200D')) return 2;
|
|
159
160
|
// Single code point: use lookup
|
|
160
161
|
const cps = Array.from(grapheme);
|
|
161
162
|
if (cps.length === 1) return codePointWidth(cps[0].codePointAt(0)!);
|