mdld-parse 0.9.8 → 0.9.9
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 +70 -1
- package/dist/README.md +70 -1
- package/dist/docs/origin.md +2 -1
- package/dist/examples/demo/journal.md +20 -22
- package/dist/index.html +214 -188
- package/dist/index.js +24 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -417,7 +417,9 @@ function le(e, t) {
|
|
|
417
417
|
let r = e.slice(t + 1, n).trim();
|
|
418
418
|
return r.match(/^[a-zA-Z][a-zA-Z0-9+\-.]*:/) ? {
|
|
419
419
|
url: r,
|
|
420
|
-
endPos: n + 1
|
|
420
|
+
endPos: n + 1,
|
|
421
|
+
contentStart: t + 1,
|
|
422
|
+
contentEnd: n
|
|
421
423
|
} : null;
|
|
422
424
|
}
|
|
423
425
|
function ue(e, t) {
|
|
@@ -439,7 +441,8 @@ function ue(e, t) {
|
|
|
439
441
|
content: t,
|
|
440
442
|
attrs: c?.attrs || null,
|
|
441
443
|
endPos: l,
|
|
442
|
-
|
|
444
|
+
contentStart: o,
|
|
445
|
+
contentEnd: s
|
|
443
446
|
};
|
|
444
447
|
}
|
|
445
448
|
s++;
|
|
@@ -460,7 +463,8 @@ function de(e, t) {
|
|
|
460
463
|
content: t,
|
|
461
464
|
attrs: o?.attrs || null,
|
|
462
465
|
endPos: s,
|
|
463
|
-
|
|
466
|
+
contentStart: i,
|
|
467
|
+
contentEnd: a
|
|
464
468
|
};
|
|
465
469
|
}
|
|
466
470
|
a++;
|
|
@@ -489,7 +493,8 @@ function fe(e, t) {
|
|
|
489
493
|
url: a,
|
|
490
494
|
attrs: o?.attrs || null,
|
|
491
495
|
endPos: s,
|
|
492
|
-
|
|
496
|
+
contentStart: t + 1,
|
|
497
|
+
contentEnd: n
|
|
493
498
|
};
|
|
494
499
|
}
|
|
495
500
|
function x(e, t = 0) {
|
|
@@ -523,16 +528,16 @@ function x(e, t = 0) {
|
|
|
523
528
|
i = a.endPos;
|
|
524
529
|
continue;
|
|
525
530
|
}
|
|
526
|
-
let l = t + i, u = t + a.endPos, d = t +
|
|
531
|
+
let l = t + i, u = t + a.endPos, d = t + a.contentEnd, f = [t + a.contentStart, t + a.contentEnd], p = {
|
|
527
532
|
type: s,
|
|
528
533
|
text: a.content === void 0 ? a.text === void 0 ? o : a.text : a.content,
|
|
529
534
|
range: [l, u],
|
|
530
|
-
valueRange:
|
|
535
|
+
valueRange: f,
|
|
531
536
|
attrs: c,
|
|
532
537
|
url: o,
|
|
533
538
|
pos: a.endPos
|
|
534
539
|
};
|
|
535
|
-
c && (
|
|
540
|
+
c && (p.attrsRange = [d, u]), n.push(p), i = a.endPos;
|
|
536
541
|
}
|
|
537
542
|
return n;
|
|
538
543
|
}
|
|
@@ -611,6 +616,7 @@ function ye(e, t, n, r = null) {
|
|
|
611
616
|
return {
|
|
612
617
|
blockId: e.id,
|
|
613
618
|
range: e.range,
|
|
619
|
+
valueRange: e.valueRange || null,
|
|
614
620
|
carrierType: e.carrierType,
|
|
615
621
|
subject: t.value,
|
|
616
622
|
predicate: n.value,
|
|
@@ -1003,6 +1009,10 @@ function je(e, t, n, r, i, a, o, s, c) {
|
|
|
1003
1009
|
start: r[0],
|
|
1004
1010
|
end: r[1]
|
|
1005
1011
|
},
|
|
1012
|
+
valueRange: a ? {
|
|
1013
|
+
start: a[0],
|
|
1014
|
+
end: a[1]
|
|
1015
|
+
} : null,
|
|
1006
1016
|
carrierType: o || null,
|
|
1007
1017
|
subject: e,
|
|
1008
1018
|
types: l.types,
|
|
@@ -1777,4 +1787,10 @@ function St(e) {
|
|
|
1777
1787
|
return n;
|
|
1778
1788
|
}
|
|
1779
1789
|
//#endregion
|
|
1780
|
-
|
|
1790
|
+
//#region src/index.js
|
|
1791
|
+
function Ct({ text: e, quad: t, value: n, origin: r }) {
|
|
1792
|
+
let i = f(t, r?.quadIndex ? r : I({ text: e }).origin);
|
|
1793
|
+
return !i || !i.valueRange ? e : e.substring(0, i.valueRange.start) + n + e.substring(i.valueRange.end);
|
|
1794
|
+
}
|
|
1795
|
+
//#endregion
|
|
1796
|
+
export { e as DEFAULT_CONTEXT, d as DataFactory, h as expandIRI, Ve as generate, He as generateNode, Q as getIRIColor, p as hash, yt as hashIRI, St as highlightMDLD, f as locate, ze as merge, I as parse, _ as parseSemanticBlock, Je as render, g as shortenIRI, Ct as updateValue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdld-parse",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "A standards-compliant parser for **MD-LD (Markdown-Linked Data)** — a human-friendly RDF authoring format that extends Markdown with semantic annotations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"type": "git",
|
|
37
37
|
"url": "git+https://github.com/davay42/mdld-parse.git"
|
|
38
38
|
},
|
|
39
|
-
"homepage": "https://mdld.js.org",
|
|
39
|
+
"homepage": "https://mdld.js.org/",
|
|
40
40
|
"bugs": {
|
|
41
41
|
"url": "https://github.com/davay42/mdld-parse/issues"
|
|
42
42
|
},
|