koztv-blog-tools 1.3.6 → 1.3.8
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/dist/{chunk-OENFHIEQ.mjs → chunk-4ZCY7ORU.mjs} +6 -1
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +7 -1
- package/dist/index.mjs +3 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +8 -2
- package/dist/node.mjs +4 -2
- package/package.json +1 -1
|
@@ -35,8 +35,12 @@ var translitMap = {
|
|
|
35
35
|
"\u044E": "yu",
|
|
36
36
|
"\u044F": "ya"
|
|
37
37
|
};
|
|
38
|
+
function normalizeMarkdown(text) {
|
|
39
|
+
return text.replace(/\*{4,}/g, "").replace(/\*{3}([^*]+)\*{3}/g, "**$1**").replace(/^\*{2,3}\s*$/gm, "").replace(/\*\*\s*\n\s*\*\*/g, "\n").replace(/(\S)\s+\*\*/g, "$1**").replace(/\*\*\*\*/g, "**").replace(/\*\*([^*\n]{0,3})\*\*/g, "$1").replace(/\*\*([^*\n]+)\n(?!\*\*)/g, "**$1**\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
40
|
+
}
|
|
38
41
|
function cleanContent(text) {
|
|
39
|
-
|
|
42
|
+
let cleaned = text.replace(/##\s*Attachments\n(?:- [^\n]+\n?)*/g, "").replace(/- media\/\d+\/[^\n]+/g, "").replace(/#\w+@\w+/g, "").trim();
|
|
43
|
+
return normalizeMarkdown(cleaned);
|
|
40
44
|
}
|
|
41
45
|
function generateSlug(text, fallbackIdx) {
|
|
42
46
|
const cleaned = cleanContent(text);
|
|
@@ -312,6 +316,7 @@ function generateEnglishSlug(title) {
|
|
|
312
316
|
}
|
|
313
317
|
|
|
314
318
|
export {
|
|
319
|
+
normalizeMarkdown,
|
|
315
320
|
cleanContent,
|
|
316
321
|
generateSlug,
|
|
317
322
|
extractTitle,
|
package/dist/index.d.mts
CHANGED
|
@@ -33,6 +33,10 @@ interface ParsePostOptions {
|
|
|
33
33
|
/** Extract attachments from content */
|
|
34
34
|
extractAttachments?: boolean;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Normalize broken markdown formatting from Telegram
|
|
38
|
+
*/
|
|
39
|
+
declare function normalizeMarkdown(text: string): string;
|
|
36
40
|
/**
|
|
37
41
|
* Clean content by removing attachment sections and media references
|
|
38
42
|
*/
|
|
@@ -142,4 +146,4 @@ declare function translateTitle(title: string, options: TranslateOptions): Promi
|
|
|
142
146
|
*/
|
|
143
147
|
declare function generateEnglishSlug(title: string): string;
|
|
144
148
|
|
|
145
|
-
export { type AnalyticsConfig, type GoalName, type GoalParams, type GroupedPost, type ParsePostOptions, type Post, type TranslateOptions, categorizePost, cleanContent, configureAnalytics, deduplicatePosts, extractAttachments, extractExcerpt, extractTitle, generateEnglishSlug, generateSlug, groupPosts, parsePost, trackBookAppointment, trackGoal, trackLearnMore, trackServiceClick, trackTelegramClick, translateContent, translateTitle };
|
|
149
|
+
export { type AnalyticsConfig, type GoalName, type GoalParams, type GroupedPost, type ParsePostOptions, type Post, type TranslateOptions, categorizePost, cleanContent, configureAnalytics, deduplicatePosts, extractAttachments, extractExcerpt, extractTitle, generateEnglishSlug, generateSlug, groupPosts, normalizeMarkdown, parsePost, trackBookAppointment, trackGoal, trackLearnMore, trackServiceClick, trackTelegramClick, translateContent, translateTitle };
|
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,10 @@ interface ParsePostOptions {
|
|
|
33
33
|
/** Extract attachments from content */
|
|
34
34
|
extractAttachments?: boolean;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Normalize broken markdown formatting from Telegram
|
|
38
|
+
*/
|
|
39
|
+
declare function normalizeMarkdown(text: string): string;
|
|
36
40
|
/**
|
|
37
41
|
* Clean content by removing attachment sections and media references
|
|
38
42
|
*/
|
|
@@ -142,4 +146,4 @@ declare function translateTitle(title: string, options: TranslateOptions): Promi
|
|
|
142
146
|
*/
|
|
143
147
|
declare function generateEnglishSlug(title: string): string;
|
|
144
148
|
|
|
145
|
-
export { type AnalyticsConfig, type GoalName, type GoalParams, type GroupedPost, type ParsePostOptions, type Post, type TranslateOptions, categorizePost, cleanContent, configureAnalytics, deduplicatePosts, extractAttachments, extractExcerpt, extractTitle, generateEnglishSlug, generateSlug, groupPosts, parsePost, trackBookAppointment, trackGoal, trackLearnMore, trackServiceClick, trackTelegramClick, translateContent, translateTitle };
|
|
149
|
+
export { type AnalyticsConfig, type GoalName, type GoalParams, type GroupedPost, type ParsePostOptions, type Post, type TranslateOptions, categorizePost, cleanContent, configureAnalytics, deduplicatePosts, extractAttachments, extractExcerpt, extractTitle, generateEnglishSlug, generateSlug, groupPosts, normalizeMarkdown, parsePost, trackBookAppointment, trackGoal, trackLearnMore, trackServiceClick, trackTelegramClick, translateContent, translateTitle };
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ __export(index_exports, {
|
|
|
40
40
|
generateEnglishSlug: () => generateEnglishSlug,
|
|
41
41
|
generateSlug: () => generateSlug,
|
|
42
42
|
groupPosts: () => groupPosts,
|
|
43
|
+
normalizeMarkdown: () => normalizeMarkdown,
|
|
43
44
|
parsePost: () => parsePost,
|
|
44
45
|
trackBookAppointment: () => trackBookAppointment,
|
|
45
46
|
trackGoal: () => trackGoal,
|
|
@@ -88,8 +89,12 @@ var translitMap = {
|
|
|
88
89
|
"\u044E": "yu",
|
|
89
90
|
"\u044F": "ya"
|
|
90
91
|
};
|
|
92
|
+
function normalizeMarkdown(text) {
|
|
93
|
+
return text.replace(/\*{4,}/g, "").replace(/\*{3}([^*]+)\*{3}/g, "**$1**").replace(/^\*{2,3}\s*$/gm, "").replace(/\*\*\s*\n\s*\*\*/g, "\n").replace(/(\S)\s+\*\*/g, "$1**").replace(/\*\*\*\*/g, "**").replace(/\*\*([^*\n]{0,3})\*\*/g, "$1").replace(/\*\*([^*\n]+)\n(?!\*\*)/g, "**$1**\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
94
|
+
}
|
|
91
95
|
function cleanContent(text) {
|
|
92
|
-
|
|
96
|
+
let cleaned = text.replace(/##\s*Attachments\n(?:- [^\n]+\n?)*/g, "").replace(/- media\/\d+\/[^\n]+/g, "").replace(/#\w+@\w+/g, "").trim();
|
|
97
|
+
return normalizeMarkdown(cleaned);
|
|
93
98
|
}
|
|
94
99
|
function generateSlug(text, fallbackIdx) {
|
|
95
100
|
const cleaned = cleanContent(text);
|
|
@@ -375,6 +380,7 @@ function generateEnglishSlug(title) {
|
|
|
375
380
|
generateEnglishSlug,
|
|
376
381
|
generateSlug,
|
|
377
382
|
groupPosts,
|
|
383
|
+
normalizeMarkdown,
|
|
378
384
|
parsePost,
|
|
379
385
|
trackBookAppointment,
|
|
380
386
|
trackGoal,
|
package/dist/index.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
generateEnglishSlug,
|
|
10
10
|
generateSlug,
|
|
11
11
|
groupPosts,
|
|
12
|
+
normalizeMarkdown,
|
|
12
13
|
parsePost,
|
|
13
14
|
trackBookAppointment,
|
|
14
15
|
trackGoal,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
trackTelegramClick,
|
|
18
19
|
translateContent,
|
|
19
20
|
translateTitle
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-4ZCY7ORU.mjs";
|
|
21
22
|
export {
|
|
22
23
|
categorizePost,
|
|
23
24
|
cleanContent,
|
|
@@ -29,6 +30,7 @@ export {
|
|
|
29
30
|
generateEnglishSlug,
|
|
30
31
|
generateSlug,
|
|
31
32
|
groupPosts,
|
|
33
|
+
normalizeMarkdown,
|
|
32
34
|
parsePost,
|
|
33
35
|
trackBookAppointment,
|
|
34
36
|
trackGoal,
|
package/dist/node.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AnalyticsConfig, GoalName, GoalParams, GroupedPost, ParsePostOptions, Post, TranslateOptions, categorizePost, cleanContent, configureAnalytics, deduplicatePosts, extractAttachments, extractExcerpt, extractTitle, generateEnglishSlug, generateSlug, groupPosts, parsePost, trackBookAppointment, trackGoal, trackLearnMore, trackServiceClick, trackTelegramClick, translateContent, translateTitle } from './index.mjs';
|
|
1
|
+
export { AnalyticsConfig, GoalName, GoalParams, GroupedPost, ParsePostOptions, Post, TranslateOptions, categorizePost, cleanContent, configureAnalytics, deduplicatePosts, extractAttachments, extractExcerpt, extractTitle, generateEnglishSlug, generateSlug, groupPosts, normalizeMarkdown, parsePost, trackBookAppointment, trackGoal, trackLearnMore, trackServiceClick, trackTelegramClick, translateContent, translateTitle } from './index.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Telegram channel export utilities using gramjs (MTProto)
|
package/dist/node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AnalyticsConfig, GoalName, GoalParams, GroupedPost, ParsePostOptions, Post, TranslateOptions, categorizePost, cleanContent, configureAnalytics, deduplicatePosts, extractAttachments, extractExcerpt, extractTitle, generateEnglishSlug, generateSlug, groupPosts, parsePost, trackBookAppointment, trackGoal, trackLearnMore, trackServiceClick, trackTelegramClick, translateContent, translateTitle } from './index.js';
|
|
1
|
+
export { AnalyticsConfig, GoalName, GoalParams, GroupedPost, ParsePostOptions, Post, TranslateOptions, categorizePost, cleanContent, configureAnalytics, deduplicatePosts, extractAttachments, extractExcerpt, extractTitle, generateEnglishSlug, generateSlug, groupPosts, normalizeMarkdown, parsePost, trackBookAppointment, trackGoal, trackLearnMore, trackServiceClick, trackTelegramClick, translateContent, translateTitle } from './index.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Telegram channel export utilities using gramjs (MTProto)
|
package/dist/node.js
CHANGED
|
@@ -43,6 +43,7 @@ __export(node_exports, {
|
|
|
43
43
|
generateEnglishSlug: () => generateEnglishSlug,
|
|
44
44
|
generateSlug: () => generateSlug,
|
|
45
45
|
groupPosts: () => groupPosts,
|
|
46
|
+
normalizeMarkdown: () => normalizeMarkdown,
|
|
46
47
|
parsePost: () => parsePost,
|
|
47
48
|
processFromFiles: () => processFromFiles,
|
|
48
49
|
resumeExport: () => resumeExport,
|
|
@@ -93,8 +94,12 @@ var translitMap = {
|
|
|
93
94
|
"\u044E": "yu",
|
|
94
95
|
"\u044F": "ya"
|
|
95
96
|
};
|
|
97
|
+
function normalizeMarkdown(text) {
|
|
98
|
+
return text.replace(/\*{4,}/g, "").replace(/\*{3}([^*]+)\*{3}/g, "**$1**").replace(/^\*{2,3}\s*$/gm, "").replace(/\*\*\s*\n\s*\*\*/g, "\n").replace(/(\S)\s+\*\*/g, "$1**").replace(/\*\*\*\*/g, "**").replace(/\*\*([^*\n]{0,3})\*\*/g, "$1").replace(/\*\*([^*\n]+)\n(?!\*\*)/g, "**$1**\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
99
|
+
}
|
|
96
100
|
function cleanContent(text) {
|
|
97
|
-
|
|
101
|
+
let cleaned = text.replace(/##\s*Attachments\n(?:- [^\n]+\n?)*/g, "").replace(/- media\/\d+\/[^\n]+/g, "").replace(/#\w+@\w+/g, "").trim();
|
|
102
|
+
return normalizeMarkdown(cleaned);
|
|
98
103
|
}
|
|
99
104
|
function generateSlug(text, fallbackIdx) {
|
|
100
105
|
const cleaned = cleanContent(text);
|
|
@@ -511,7 +516,7 @@ function entitiesToMarkdown(text, entities) {
|
|
|
511
516
|
lastPos = marker.pos;
|
|
512
517
|
}
|
|
513
518
|
result += text.substring(lastPos);
|
|
514
|
-
result = result.replace(/(\S) \*\*/g, "$1** ").replace(/\*\* (\S)/g, " **$1").replace(/(\S) \*/g, "$1* ").replace(/\* (\S)/g, " *$1");
|
|
519
|
+
result = result.replace(/(\S) \*\*/g, "$1** ").replace(/\*\* (\S)/g, " **$1").replace(/(\S) \*/g, "$1* ").replace(/\* (\S)/g, " *$1").replace(/\*{4,}/g, "").replace(/\*{3}/g, "**").replace(/\*\*\s*\n\s*\*\*/g, "\n").replace(/^\*\*\s*$/gm, "").replace(/\n{3,}/g, "\n\n");
|
|
515
520
|
return result;
|
|
516
521
|
}
|
|
517
522
|
async function defaultReadline(prompt) {
|
|
@@ -1324,6 +1329,7 @@ Processing: ${postId}`);
|
|
|
1324
1329
|
generateEnglishSlug,
|
|
1325
1330
|
generateSlug,
|
|
1326
1331
|
groupPosts,
|
|
1332
|
+
normalizeMarkdown,
|
|
1327
1333
|
parsePost,
|
|
1328
1334
|
processFromFiles,
|
|
1329
1335
|
resumeExport,
|
package/dist/node.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
generateEnglishSlug,
|
|
10
10
|
generateSlug,
|
|
11
11
|
groupPosts,
|
|
12
|
+
normalizeMarkdown,
|
|
12
13
|
parsePost,
|
|
13
14
|
trackBookAppointment,
|
|
14
15
|
trackGoal,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
trackTelegramClick,
|
|
18
19
|
translateContent,
|
|
19
20
|
translateTitle
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-4ZCY7ORU.mjs";
|
|
21
22
|
|
|
22
23
|
// src/telegram.ts
|
|
23
24
|
import { TelegramClient, Api } from "telegram";
|
|
@@ -161,7 +162,7 @@ function entitiesToMarkdown(text, entities) {
|
|
|
161
162
|
lastPos = marker.pos;
|
|
162
163
|
}
|
|
163
164
|
result += text.substring(lastPos);
|
|
164
|
-
result = result.replace(/(\S) \*\*/g, "$1** ").replace(/\*\* (\S)/g, " **$1").replace(/(\S) \*/g, "$1* ").replace(/\* (\S)/g, " *$1");
|
|
165
|
+
result = result.replace(/(\S) \*\*/g, "$1** ").replace(/\*\* (\S)/g, " **$1").replace(/(\S) \*/g, "$1* ").replace(/\* (\S)/g, " *$1").replace(/\*{4,}/g, "").replace(/\*{3}/g, "**").replace(/\*\*\s*\n\s*\*\*/g, "\n").replace(/^\*\*\s*$/gm, "").replace(/\n{3,}/g, "\n\n");
|
|
165
166
|
return result;
|
|
166
167
|
}
|
|
167
168
|
async function defaultReadline(prompt) {
|
|
@@ -973,6 +974,7 @@ export {
|
|
|
973
974
|
generateEnglishSlug,
|
|
974
975
|
generateSlug,
|
|
975
976
|
groupPosts,
|
|
977
|
+
normalizeMarkdown,
|
|
976
978
|
parsePost,
|
|
977
979
|
processFromFiles,
|
|
978
980
|
resumeExport,
|