@mtcute/markdown-parser 0.22.0 → 0.22.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/README.md +1 -1
- package/index.cjs +13 -3
- package/index.js +13 -3
- package/package.json +2 -2
package/README.md
CHANGED
package/index.cjs
CHANGED
|
@@ -290,7 +290,7 @@ function parse(strings, ...sub) {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
if (c === "\n") {
|
|
293
|
-
if (
|
|
293
|
+
if (result.length !== 0) {
|
|
294
294
|
result += "\n";
|
|
295
295
|
}
|
|
296
296
|
const nonWhitespace = text.slice(pos + 1).search(/[^ \t]/);
|
|
@@ -298,7 +298,6 @@ function parse(strings, ...sub) {
|
|
|
298
298
|
pos += nonWhitespace + 1;
|
|
299
299
|
} else {
|
|
300
300
|
pos = len;
|
|
301
|
-
result = result.trimEnd();
|
|
302
301
|
}
|
|
303
302
|
continue;
|
|
304
303
|
}
|
|
@@ -384,9 +383,20 @@ function parse(strings, ...sub) {
|
|
|
384
383
|
}
|
|
385
384
|
}
|
|
386
385
|
}
|
|
386
|
+
const resultTrimmed = result.trimStart();
|
|
387
|
+
const numCharsTrimmed = result.length - resultTrimmed.length;
|
|
388
|
+
result = resultTrimmed;
|
|
389
|
+
adjustOffsets(0, -numCharsTrimmed);
|
|
390
|
+
result = result.trimEnd();
|
|
391
|
+
const finalEntities = [];
|
|
392
|
+
for (const ent of entities) {
|
|
393
|
+
const end = ent.offset + ent.length;
|
|
394
|
+
if (end > result.length) ent.length = result.length - ent.offset;
|
|
395
|
+
if (ent.length > 0) finalEntities.push(ent);
|
|
396
|
+
}
|
|
387
397
|
return {
|
|
388
398
|
text: result,
|
|
389
|
-
entities
|
|
399
|
+
entities: finalEntities
|
|
390
400
|
};
|
|
391
401
|
}
|
|
392
402
|
const md = Object.assign(parse, {
|
package/index.js
CHANGED
|
@@ -283,7 +283,7 @@ function parse(strings, ...sub) {
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
if (c === "\n") {
|
|
286
|
-
if (
|
|
286
|
+
if (result.length !== 0) {
|
|
287
287
|
result += "\n";
|
|
288
288
|
}
|
|
289
289
|
const nonWhitespace = text.slice(pos + 1).search(/[^ \t]/);
|
|
@@ -291,7 +291,6 @@ function parse(strings, ...sub) {
|
|
|
291
291
|
pos += nonWhitespace + 1;
|
|
292
292
|
} else {
|
|
293
293
|
pos = len;
|
|
294
|
-
result = result.trimEnd();
|
|
295
294
|
}
|
|
296
295
|
continue;
|
|
297
296
|
}
|
|
@@ -377,9 +376,20 @@ function parse(strings, ...sub) {
|
|
|
377
376
|
}
|
|
378
377
|
}
|
|
379
378
|
}
|
|
379
|
+
const resultTrimmed = result.trimStart();
|
|
380
|
+
const numCharsTrimmed = result.length - resultTrimmed.length;
|
|
381
|
+
result = resultTrimmed;
|
|
382
|
+
adjustOffsets(0, -numCharsTrimmed);
|
|
383
|
+
result = result.trimEnd();
|
|
384
|
+
const finalEntities = [];
|
|
385
|
+
for (const ent of entities) {
|
|
386
|
+
const end = ent.offset + ent.length;
|
|
387
|
+
if (end > result.length) ent.length = result.length - ent.offset;
|
|
388
|
+
if (ent.length > 0) finalEntities.push(ent);
|
|
389
|
+
}
|
|
380
390
|
return {
|
|
381
391
|
text: result,
|
|
382
|
-
entities
|
|
392
|
+
entities: finalEntities
|
|
383
393
|
};
|
|
384
394
|
}
|
|
385
395
|
const md = Object.assign(parse, {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtcute/markdown-parser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.22.
|
|
4
|
+
"version": "0.22.3",
|
|
5
5
|
"description": "Markdown entities parser for mtcute",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@mtcute/core": "^0.22.
|
|
8
|
+
"@mtcute/core": "^0.22.3",
|
|
9
9
|
"long": "5.2.3"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|