mdld-parse 0.4.0 → 0.4.2
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 +34 -1
- package/package.json +5 -2
- package/src/parse.js +340 -273
- package/src/render.js +490 -0
- package/src/serialize.js +74 -93
- package/src/utils.js +60 -106
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# MD-LD Parse v0.
|
|
1
|
+
# MD-LD Parse v0.4.1
|
|
2
2
|
|
|
3
3
|
**Markdown-Linked Data (MD-LD)** — a deterministic, streaming-friendly RDF authoring format that extends Markdown with explicit `{...}` annotations.
|
|
4
4
|
|
|
@@ -34,6 +34,7 @@ ex:armstrong schema:name "Neil Armstrong" .
|
|
|
34
34
|
|
|
35
35
|
## Core Features
|
|
36
36
|
|
|
37
|
+
- **Prefix folding**: Build hierarchical namespaces with lightweight IRI authoring
|
|
37
38
|
- **Subject declarations**: `{=IRI}` and `{=#fragment}` for context setting
|
|
38
39
|
- **Object IRIs**: `{+IRI}` and `{+#fragment}` for temporary object declarations
|
|
39
40
|
- **Four predicate forms**: `p` (S→L), `?p` (S→O), `!p` (O→S)
|
|
@@ -255,6 +256,38 @@ ex:book schema:hasPart ex:part .
|
|
|
255
256
|
# Person {=ex:alice .foaf:Person}
|
|
256
257
|
```
|
|
257
258
|
|
|
259
|
+
### Prefix Folding: Lightweight IRI Authoring
|
|
260
|
+
|
|
261
|
+
Build hierarchical namespaces by referencing previously defined prefixes:
|
|
262
|
+
|
|
263
|
+
```markdown
|
|
264
|
+
# Create your domain authority
|
|
265
|
+
[my] <tag:mymail@domain.com,2026:>
|
|
266
|
+
|
|
267
|
+
# Build namespace hierarchy
|
|
268
|
+
[j] <my:journal:>
|
|
269
|
+
[p] <my:property:>
|
|
270
|
+
[c] <my:class:>
|
|
271
|
+
[person] <my:people:>
|
|
272
|
+
|
|
273
|
+
# Use in content
|
|
274
|
+
# 2026-01-27 {=j:2026-01-27 .c:Event p:date ^^xsd:date}
|
|
275
|
+
|
|
276
|
+
## Harry {=person:harry p:name}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Resolves to absolute IRIs:**
|
|
280
|
+
- `j:2026-01-27` → `tag:mymail@domain.com,2026:journal:2026-01-27`
|
|
281
|
+
- `c:Event` → `tag:mymail@domain.com,2026:class:Event`
|
|
282
|
+
- `p:date` → `tag:mymail@domain.com,2026:property:date`
|
|
283
|
+
- `person:harry` → `tag:mymail@domain.com,2026:people:harry`
|
|
284
|
+
|
|
285
|
+
**Benefits:**
|
|
286
|
+
- **Lightweight**: No external ontology dependencies
|
|
287
|
+
- **Domain authority**: Use `tag:` URIs for personal namespaces
|
|
288
|
+
- **Hierarchical**: Build deep namespace structures
|
|
289
|
+
- **Streaming-safe**: Forward-reference only, single-pass parsing
|
|
290
|
+
|
|
258
291
|
## API Reference
|
|
259
292
|
|
|
260
293
|
### `parse(markdown, options)`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdld-parse",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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
|
"main": "index.js",
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
"rdfjs",
|
|
25
25
|
"browser",
|
|
26
26
|
"web-worker",
|
|
27
|
-
"parser"
|
|
27
|
+
"parser",
|
|
28
|
+
"prefix-folding",
|
|
29
|
+
"curie",
|
|
30
|
+
"iri-authoring"
|
|
28
31
|
],
|
|
29
32
|
"author": "davay42",
|
|
30
33
|
"repository": {
|