mdld-parse 0.2.3 → 0.2.5

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.
Files changed (3) hide show
  1. package/README.md +22 -27
  2. package/index.js +775 -201
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,15 +1,14 @@
1
1
  # MD-LD Parse v0.2
2
2
 
3
- **Markdown-Linked Data (MD-LD)** — a deterministic, streaming-friendly RDF authoring format that extends Markdown with explicit `{}` annotations.
3
+ **Markdown-Linked Data (MD-LD)** — a deterministic, streaming-friendly RDF authoring format that extends Markdown with explicit `{...}` annotations.
4
4
 
5
5
  [![NPM](https://img.shields.io/npm/v/mdld-parse)](https://www.npmjs.com/package/mdld-parse)
6
- [![License](https://img.shields.io/npm/l/mdld-parse)](https://github.com/mdld-js/mdld-parse)
7
6
 
8
- [Documentation](https://mdld.js.org) | [Specification](https://mdld.js.org/spec) | [Playground](https://mdld.js.org/playground)
7
+ [Documentation](https://mdld.js.org) | [Repository](https://github.com/davay42/mdld-parse) | [Playground](https://mdld.js.org/playground)
9
8
 
10
9
  ## What is MD-LD?
11
10
 
12
- MD-LD allows you to author RDF graphs directly in Markdown using explicit `{}` annotations:
11
+ MD-LD allows you to author RDF graphs directly in Markdown using explicit `{...}` annotations:
13
12
 
14
13
  ```markdown
15
14
  # Apollo 11 {=ex:apollo11 .SpaceMission}
@@ -32,8 +31,8 @@ ex:apollo11 a schema:SpaceMission ;
32
31
 
33
32
  MD-LD v0.2 provides strict semantic guarantees:
34
33
 
35
- 1. **CommonMark-preserving** — Removing `{}` yields valid Markdown
36
- 2. **Explicit semantics** — Every quad originates from explicit `{}`
34
+ 1. **CommonMark-preserving** — Removing `{...}` yields valid Markdown
35
+ 2. **Explicit semantics** — Every quad originates from explicit `{...}`
37
36
  3. **Single-pass parsing** — Streaming-friendly, deterministic
38
37
  4. **No blank nodes** — All subjects are stable IRIs
39
38
  5. **Complete traceability** — Every quad maps to source location
@@ -140,7 +139,7 @@ Links create relationships (use `?` prefix):
140
139
  ```markdown
141
140
  # Mission {=ex:apollo11}
142
141
 
143
- [NASA](ex:nasa) {?organizer}
142
+ [NASA] {=ex:nasa ?organizer}
144
143
  ```
145
144
 
146
145
  ```turtle
@@ -149,12 +148,12 @@ ex:apollo11 schema:organizer ex:nasa .
149
148
 
150
149
  ### Resource Declaration
151
150
 
152
- Declare resources inline with `(=iri)`:
151
+ Declare resources inline with `{=iri}`:
153
152
 
154
153
  ```markdown
155
154
  # Mission {=ex:apollo11}
156
155
 
157
- [Neil Armstrong](=ex:armstrong) {?commander .Person}
156
+ [Neil Armstrong] {=ex:armstrong ?commander .Person}
158
157
  ```
159
158
 
160
159
  ```turtle
@@ -171,8 +170,8 @@ Lists require explicit subjects per item:
171
170
 
172
171
  Ingredients: {?ingredient .Ingredient}
173
172
 
174
- - [Flour](=ex:flour) {name}
175
- - [Water](=ex:water) {name}
173
+ - Flour {=ex:flour name}
174
+ - Water {=ex:water name}
176
175
  ```
177
176
 
178
177
  ```turtle
@@ -219,7 +218,7 @@ Reverse the relationship direction:
219
218
 
220
219
  Part of: {^?hasPart}
221
220
 
222
- - [Book](=ex:book) {}
221
+ - Book {=ex:book}
223
222
  ```
224
223
 
225
224
  ```turtle
@@ -294,7 +293,7 @@ Apply RDF changes back to markdown with proper positioning.
294
293
  **Returns:** `{ text, origin }`
295
294
 
296
295
  - `text` — Updated markdown
297
- - `origin` — Updated origin tracking
296
+ - `origin` — Updated origin tracking vacant slots
298
297
 
299
298
  **Example:**
300
299
 
@@ -331,21 +330,17 @@ console.log(updated.text);
331
330
  Only specific markdown elements can carry semantic values:
332
331
 
333
332
  **Inline:**
334
- - `[text]` — span with annotation
335
- - `[text](url)` — link to external resource
336
- - `[text](=iri)` — inline resource declaration
333
+ - `[text] {...}` — span with annotation
334
+ - `[text](url) {...}` — link to external resource
335
+ - `[text] {...}` — inline resource declaration
336
+ - `![alt text](image.png) {...}` — embedding with annotation
337
337
 
338
338
  **Block:**
339
339
  - Headings (`# Title`)
340
- - List items (`- item`)
340
+ - List items (`- item`, `1. item`) (single-level)
341
341
  - Blockquotes (`> quote`)
342
342
  - Code blocks (` ```lang `)
343
343
 
344
- **Non-carriers:**
345
- - Plain paragraphs without `[...]`
346
- - Images (future)
347
- - Tables (future)
348
-
349
344
  ## Architecture
350
345
 
351
346
  ### Design Principles
@@ -383,12 +378,12 @@ MD-LD explicitly forbids to ensure deterministic parsing:
383
378
 
384
379
  Attendees: {?attendee}
385
380
 
386
- - [Alice](=urn:person:alice) {name}
387
- - [Bob](=urn:person:bob) {name}
381
+ - Alice {=urn:person:alice name}
382
+ - Bob {=urn:person:bob name}
388
383
 
389
384
  Action items: {?actionItem}
390
385
 
391
- - [Review proposal](=urn:task:1) {name}
386
+ - Review proposal {=urn:task:1 name}
392
387
  ```
393
388
 
394
389
  ### Developer Documentation
@@ -401,7 +396,7 @@ Action items: {?actionItem}
401
396
 
402
397
  Example:
403
398
 
404
- ```bash {=api:/users/:id/example .CodeExample programmingLanguage}
399
+ ```bash {=api:/users/:id#example .CodeExample text}
405
400
  curl https://api.example.com/users/123
406
401
  ```
407
402
  ````
@@ -412,7 +407,7 @@ curl https://api.example.com/users/123
412
407
  # Paper {=doi:10.1234/example .ScholarlyArticle}
413
408
 
414
409
  [Semantic Web] {about}
415
- [Alice Johnson](=orcid:0000-0001-2345-6789) {?author .Person}
410
+ [Alice Johnson] {=orcid:0000-0001-2345-6789 author}
416
411
  [2024-01] {datePublished ^^xsd:gYearMonth}
417
412
 
418
413
  > This paper explores semantic markup in Markdown. {abstract @en}