@iletai/nzb 1.4.0 → 1.4.1

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.
@@ -107,19 +107,27 @@ export function toTelegramHTML(text) {
107
107
  out = out.replace(/^(\s*)[-*]\s+/gm, "$1• ");
108
108
  // 9. Ordered lists: keep as-is (1. 2. 3.)
109
109
  // 10. Strikethrough ~~text~~ → <s>
110
- out = out.replace(/~~(.+?)~~/g, (_m, inner) => stashToken(`<s>\x00ESC${inner}\x00ESC</s>`));
111
- // 11. Bold **text** → <b>
112
- out = out.replace(/\*\*(.+?)\*\*/g, (_m, inner) => stashToken(`<b>\x00ESC${inner}\x00ESC</b>`));
113
- // 12. Italic *text* → <i>
114
- out = out.replace(/\*(.+?)\*/g, (_m, inner) => stashToken(`<i>\x00ESC${inner}\x00ESC</i>`));
115
- // 13. Underline __text__ → <u>
116
- out = out.replace(/__(.+?)__/g, (_m, inner) => stashToken(`<u>\x00ESC${inner}\x00ESC</u>`));
117
- // 14. Escape remaining plain text
110
+ out = out.replace(/~~(.+?)~~/g, (_m, inner) => stashToken(`<s>${escapeHtml(inner)}</s>`));
111
+ // 11. Bold+italic ***text*** → <b><i>text</i></b>
112
+ out = out.replace(/\*\*\*(.+?)\*\*\*/g, (_m, inner) => stashToken(`<b><i>${escapeHtml(inner)}</i></b>`));
113
+ // 12. Bold **text** → <b> (inner may contain stash tokens, preserve them)
114
+ out = out.replace(/\*\*(.+?)\*\*/g, (_m, inner) => {
115
+ const escaped = escapeHtml(inner.replace(/\x00S\d+\x00/g, (tok) => `\x00KEEP${tok}\x00KEEP`));
116
+ const restored = escaped.replace(/\x00KEEP\x00S(\d+)\x00\x00KEEP/g, (_m2, i) => stash[+i]);
117
+ return stashToken(`<b>${restored}</b>`);
118
+ });
119
+ // 13. Italic *text* → <i>
120
+ out = out.replace(/\*(.+?)\*/g, (_m, inner) => {
121
+ const escaped = escapeHtml(inner.replace(/\x00S\d+\x00/g, (tok) => `\x00KEEP${tok}\x00KEEP`));
122
+ const restored = escaped.replace(/\x00KEEP\x00S(\d+)\x00\x00KEEP/g, (_m2, i) => stash[+i]);
123
+ return stashToken(`<i>${restored}</i>`);
124
+ });
125
+ // 14. Underline __text__ → <u>
126
+ out = out.replace(/__(.+?)__/g, (_m, inner) => stashToken(`<u>${escapeHtml(inner)}</u>`));
127
+ // 15. Escape remaining plain text
118
128
  out = escapeHtml(out);
119
- // 15. Restore stashed tokens
129
+ // 16. Restore stashed tokens
120
130
  out = out.replace(/\x00S(\d+)\x00/g, (_m, i) => stash[+i]);
121
- // 16. Escape inner text of formatting tags (marked with ESC)
122
- out = out.replace(/\x00ESC([\s\S]*?)\x00ESC/g, (_m, inner) => escapeHtml(inner));
123
131
  // 17. Clean up excessive blank lines
124
132
  out = out.replace(/\n{3,}/g, "\n\n");
125
133
  return out.trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iletai/nzb",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "NZB — a personal AI assistant for developers, built on the GitHub Copilot SDK",
5
5
  "bin": {
6
6
  "nzb": "dist/cli.js"