@alexnodeland/claude-telegram 0.3.2 → 0.3.3
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/html.ts +14 -0
package/package.json
CHANGED
package/src/html.ts
CHANGED
|
@@ -98,9 +98,23 @@ function convertInlineFormatting(text: string): string {
|
|
|
98
98
|
// Links: [text](url)
|
|
99
99
|
s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
|
|
100
100
|
|
|
101
|
+
// Numbered lists: leading "1. " → keep number with period
|
|
102
|
+
s = s.replace(/^[\t ]*(\d+)\.\s+/gm, "$1. ");
|
|
103
|
+
|
|
101
104
|
// Bullet lists: leading "- " or "* " → "• "
|
|
102
105
|
s = s.replace(/^[\t ]*[-*]\s+/gm, "• ");
|
|
103
106
|
|
|
107
|
+
// Blockquotes: leading "> " → <blockquote>
|
|
108
|
+
// Collect consecutive quoted lines into a single blockquote
|
|
109
|
+
s = s.replace(/(?:^> (.+)$(?:\n|$))+/gm, (match) => {
|
|
110
|
+
const inner = match
|
|
111
|
+
.split("\n")
|
|
112
|
+
.map((line) => line.replace(/^> /, ""))
|
|
113
|
+
.filter((line) => line !== "")
|
|
114
|
+
.join("\n");
|
|
115
|
+
return `<blockquote>${inner}</blockquote>\n`;
|
|
116
|
+
});
|
|
117
|
+
|
|
104
118
|
return s;
|
|
105
119
|
})
|
|
106
120
|
.join("");
|