mdld-parse 1.0.4 → 1.0.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 +85 -17
  2. package/dist/index.js +60 -8
  3. package/package.json +33 -27
package/README.md CHANGED
@@ -2,20 +2,11 @@
2
2
 
3
3
  **Markdown-Linked Data** — Write RDF knowledge graphs as plain Markdown. Parse to quads, generate back, merge documents. Zero dependencies, round-trip safe.
4
4
 
5
- Unlike Turtle, JSON-LD, or RDF/XML, MD-LD embeds semantic annotations directly into natural Markdown text. A Markdown file becomes a knowledge graph — readable by humans and machines simultaneously.
5
+ MD-LD is the only RDF format that is both writable by humans and parseable by machines in the same document. Unlike Turtle (write-only), JSON-LD (machine-only), and RDFa (embedded-in-HTML-only), MD-LD annotations flow with natural Markdown prose — making knowledge graphs readable without a renderer.
6
6
 
7
- [![NPM](https://img.shields.io/npm/v/mdld-parse)](https://www.npmjs.com/package/mdld-parse)
7
+ **[mdld.js.org](https://mdld.js.org/)**
8
8
 
9
- [Homepage](https://mdld.js.org) | [Repository](https://github.com/davay42/mdld-parse)
10
-
11
-
12
- ## 📚 Documentation Hub
13
-
14
- - **📋 [Specification](./spec/index.md)** — Formal specification and test suite
15
- - **📖 [Documentation](./docs/index.md)** — Complete documentation with guides and references
16
- - **🎯 [Examples](./examples/index.md)** — Real-world MD-LD examples and use cases
17
- - **📚 [Grammar](./grammar/index.md)** — EBNF grammar specification
18
- - **🧩 [Ontologies](./ontologies/index.md)** — W3C and related standard ontologies used in RDF
9
+ [![NPM](https://img.shields.io/npm/v/mdld-parse)](https://www.npmjs.com/package/mdld-parse/)
19
10
 
20
11
  ## 🎯 What is MD-LD?
21
12
 
@@ -93,6 +84,7 @@ MD-LD removes the intermediary. Writing becomes publishing. Publishing becomes g
93
84
  - **Decentralized authority** — RFC 4151 tag: URIs enable self-sovereign identity without central registries
94
85
  - **Text-native agent memory** - LLM Agent memory substrate in plain text — parse context, write knowledge, merge with other agents, all as Markdown files. No database required.
95
86
 
87
+
96
88
  ### Real-World Applications
97
89
 
98
90
  #### Personal Knowledge Management
@@ -518,6 +510,80 @@ Comprehensive test suite covering:
518
510
  - Round-trip parse/generate cycles
519
511
  - Origin tracking and provenance
520
512
 
513
+
514
+ ## 📚 Documentation Hub
515
+
516
+ - **📋 [Specification](./spec/index.md)** — Formal specification and test suite
517
+ - [Formal Specification](./spec/Spec.md)
518
+ - [Compact Spec](./spec/Spec-compact.md)
519
+ - [Ultra Compact Spec](./spec/Spec-ultra.md)
520
+ - **📚 [Grammar](./grammar/index.md)** — EBNF+TextMate grammar specifications
521
+ - [The TextMate grammar](./grammar/mdld.tmLanguage.json)
522
+ - [ISO 14977 EBNF grammar](./grammar/mdld.ebnf)
523
+ - **📖 [Documentation](./docs/index.md)** — Complete documentation with guides and references
524
+ - [MD-LD Authoring Guide](./docs/Guide.md)
525
+ - [One Page Guide](./docs/one-page.md)
526
+ - [Semantic Infrastructure as Readable Text](./docs/Semantic-Text.md)
527
+ - [Elevated Statements](./docs/statements.md)
528
+ - [Primary Metadata System](./docs/primary-subject.md)
529
+ - [Origin System](./docs/origin.md)
530
+ - [Polarity & Retraction](./docs/polarity.md)
531
+ - [Subject System](./docs/Subject.md)
532
+ - [API Reference](./docs/API.md)
533
+ - [Generate: Quads to MDLD](./docs/generate.md)
534
+ - [Diff Documents](./docs/diff.md)
535
+ - [Syntax Reference](./docs/Syntax.md)
536
+ - [Architecture & Design](./docs/Architecture.md)
537
+ - [Parser Architecture](./docs/Parser.md)
538
+ - [Performance Benchmarks](./docs/Performance.md)
539
+ - [Token Efficiency](./docs/Token-Efficiency.md)
540
+ - [Knowledge Round Trip](./docs/Knowledge-Round-Trip.md)
541
+ - [Human-Scale Software & Semantic Infrastructure](./docs/Human-Scale.md)
542
+ - [Quad[] as a Universal Semantic Runtime](./docs/quad-runtime.md)
543
+ - [Use Cases](./docs/Use-Cases.md)
544
+ - **🎯 [Examples](./examples/index.md)** — Real-world MD-LD examples and use cases
545
+ - [Minimal](./examples/demo/minimal.md)
546
+ - [One-Page Guide](./examples/one-page.md)
547
+ - [Few-Shot Examples](./examples/few-shot.md)
548
+ - [Journal](./examples/demo/journal.md)
549
+ - [Tasks](./examples/demo/tasks.md)
550
+ - [Medical AI Research](./examples/demo/research.md)
551
+ - [Cookbook](./examples/Cookbook.md)
552
+ - [Website Redesign Project](./examples/demo/project.md)
553
+ - [Task Management System](./examples/demo/tasks.md)
554
+ - [Cassini-Huygens Mission](./examples/demo/space-mission.md)
555
+ - [RDF Fundamentals](./examples/demo/rdf.md)
556
+ - [PROV-O Patterns](./examples/demo/prov.md)
557
+ - [SHACL Validation](./examples/demo/shacl.md)
558
+ - [XSD Datatypes](./examples/demo/xsd.md)
559
+ - [Status & SHACL Validation](./examples/Status-SHACL.md)
560
+ - [LLM Time Workflow](./examples/llm-time-workflow.md)
561
+ - [Research Workflow](./examples/workflow.md)
562
+ - [Dogfood](./examples/dogfood.md)
563
+ - **🧩 [Ontologies](./ontologies/index.md)** — W3C and related standard ontologies used in RDF
564
+ - [RDF — Resource Description Framework](./ontologies/rdf.md)
565
+ - [RDFS — RDF Schema](./ontologies/rdfs.md)
566
+ - [SHACL — Shapes Constraint Language](./ontologies/shacl.md)
567
+ - [PROV-O — W3C Provenance Ontology](./ontologies/prov-o.md)
568
+ - [XSD — XML Schema Definition Datatypes](./ontologies/xsd.md)
569
+ - [DCTERMS — Dublin Core Metadata Terms](./ontologies/dcterms.md)
570
+ - [DCAT — Data Catalog Vocabulary](./ontologies/dcat.md)
571
+ - [FOAF — Friend of a Friend](./ontologies/foaf.md)
572
+ - [VCard](./ontologies/vcard.md)
573
+ - [Time — OWL-Time Ontology](./ontologies/time.md)
574
+ - [Activity Streams 2.0](./ontologies/activity-streams-2.md)
575
+ - [SKOS — Simple Knowledge Organization System](./ontologies/skos.md)
576
+ - [Schema.org](./ontologies/schemaorg.md)
577
+ - [CIDOC CRM — Conceptual Reference Model](./ontologies/cidoc_crm.md)
578
+ - [SOSA — Sensor, Observation, Sample, and Actuator](./ontologies/sosa.md)
579
+ - [QUDT — Quantities, Units, Dimensions and Types](./ontologies/qudt.md)
580
+ - [GOLD — General Ontology for Linguistic Description](./ontologies/gold.md)
581
+ - [LexInfo — Lexical Information Ontology](./ontologies/lexinfo.md)
582
+ - [OWL — Web Ontology Language](./ontologies/owl.md)
583
+ - [P-PLAN — Plan Ontology](./ontologies/p-plan.md)
584
+ - [Hydra — Hypermedia API Vocabulary](./ontologies/hydra.md)
585
+ - [Web Annotations](./ontologies/web-annotations.md)
586
+
521
587
  ## Governance
522
588
 
523
589
  MD-LD is a craft project. Its coherence comes from a single evolving understanding of how semantic text should work — not from consensus, but from sustained attention to the same problem over time.
@@ -532,12 +598,14 @@ This means:
532
598
 
533
599
  ## Licensing
534
600
 
535
- MD-LD is published as copyrighted source material. No open-source license applies.
601
+ MD-LD is currently published as copyrighted source material.
602
+
603
+ The project is under active development and no open-source license has been selected yet.
536
604
 
537
- Governance and licensing are determined by the author as the project evolves.
605
+ Individuals, researchers, educators, and non-commercial users are welcome to experiment with the technology.
538
606
 
539
- Individuals and small groups are welcome to study, use, and build with MD-LD.
607
+ Organizations interested in production or commercial use should contact the author.
540
608
 
541
- Organizations that need a formal license grant are invited to contact the author.
609
+ The long-term governance and licensing model remains under evaluation.
542
610
 
543
- All rights remain reserved.
611
+ The primary goal at this stage is preserving the simplicity, interoperability, and long-term integrity of the system while the ecosystem forms around it.
package/dist/index.js CHANGED
@@ -133,10 +133,12 @@ var DataFactory = {
133
133
  let datatype = languageOrDataType ? languageOrDataType.value : "";
134
134
  if (datatype === "") {
135
135
  if (typeof value === "boolean") datatype = XSD_BOOLEAN;
136
- else if (typeof value === "number") if (Number.isFinite(value)) datatype = Number.isInteger(value) ? XSD_INTEGER : XSD_DOUBLE;
137
- else {
138
- datatype = XSD_DOUBLE;
139
- if (!Number.isNaN(value)) value = value > 0 ? "INF" : "-INF";
136
+ else if (typeof value === "number") {
137
+ if (Number.isFinite(value)) datatype = Number.isInteger(value) ? XSD_INTEGER : XSD_DOUBLE;
138
+ else {
139
+ datatype = XSD_DOUBLE;
140
+ if (!Number.isNaN(value)) value = value > 0 ? "INF" : "-INF";
141
+ }
140
142
  }
141
143
  }
142
144
  return datatype === "" || datatype === "http://www.w3.org/2001/XMLSchema#string" ? new Literal(`"${escapedValue}"`) : new Literal(`"${escapedValue}"^^${datatype}`);
@@ -773,9 +775,7 @@ function scanInlineCarriers(text, baseOffset = 0) {
773
775
  case "_":
774
776
  detected = detectEmphasis(text, pos);
775
777
  break;
776
- case "`":
777
- detected = detectCodeSpan(text, pos);
778
- break;
778
+ case "`": detected = detectCodeSpan(text, pos);
779
779
  }
780
780
  if (!detected) {
781
781
  pos++;
@@ -1122,6 +1122,48 @@ function scanTokens(text) {
1122
1122
  const lines = text.split("\n");
1123
1123
  let pos = 0;
1124
1124
  let codeBlock = null;
1125
+ let sfcBlock = null;
1126
+ function detectSfcStart(trimmed) {
1127
+ if (trimmed.startsWith("<!--")) return true;
1128
+ return /^<(script|style|template)\b/i.test(trimmed);
1129
+ }
1130
+ function checkSfcClose(line) {
1131
+ if (!sfcBlock) return;
1132
+ if (sfcBlock.tag === "comment") {
1133
+ if (line.includes("-->")) sfcBlock = null;
1134
+ } else if (sfcBlock.tag === "script" || sfcBlock.tag === "style") {
1135
+ if (new RegExp(`</\\s*${sfcBlock.tag}\\s*>`, "i").test(line)) sfcBlock = null;
1136
+ } else if (sfcBlock.tag === "template") {
1137
+ const openMatches = (line.match(/<template\b/gi) || []).length;
1138
+ const closeMatches = (line.match(/<\/template>/gi) || []).length;
1139
+ sfcBlock.depth += openMatches - closeMatches;
1140
+ if (sfcBlock.depth <= 0) sfcBlock = null;
1141
+ }
1142
+ }
1143
+ function handleSfcStart(line) {
1144
+ const trimmed = line.trim();
1145
+ if (trimmed.startsWith("<!--")) sfcBlock = {
1146
+ tag: "comment",
1147
+ depth: 1
1148
+ };
1149
+ else {
1150
+ const match = trimmed.match(/^<(script|style|template)\b/i);
1151
+ if (!match) return false;
1152
+ const tag = match[1].toLowerCase();
1153
+ sfcBlock = {
1154
+ tag,
1155
+ depth: tag === "template" ? 0 : 1
1156
+ };
1157
+ }
1158
+ mdLines.push(line);
1159
+ checkSfcClose(line);
1160
+ return true;
1161
+ }
1162
+ function handleSfcContent(line) {
1163
+ mdLines.push(line);
1164
+ checkSfcClose(line);
1165
+ return true;
1166
+ }
1125
1167
  const PROCESSORS = [
1126
1168
  {
1127
1169
  type: "fence",
@@ -1129,10 +1171,20 @@ function scanTokens(text) {
1129
1171
  process: handleFence
1130
1172
  },
1131
1173
  {
1132
- type: "content",
1174
+ type: "codeContent",
1133
1175
  test: () => codeBlock,
1134
1176
  process: (line) => codeBlock.content.push(line)
1135
1177
  },
1178
+ {
1179
+ type: "sfcContent",
1180
+ test: () => sfcBlock,
1181
+ process: handleSfcContent
1182
+ },
1183
+ {
1184
+ type: "sfcStart",
1185
+ test: (line) => detectSfcStart(line.trim()),
1186
+ process: handleSfcStart
1187
+ },
1136
1188
  {
1137
1189
  type: "prefix",
1138
1190
  test: (line) => detectPrefix(line),
package/package.json CHANGED
@@ -1,9 +1,30 @@
1
1
  {
2
2
  "name": "mdld-parse",
3
- "version": "1.0.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.",
3
+ "version": "1.0.5",
4
+ "description": "Write RDF knowledge graphs as plain Markdown. Parse to quads, generate back, merge documents. The human-friendly semantic web format.",
5
+ "keywords": [
6
+ "rdf",
7
+ "linked-data",
8
+ "semantic-web",
9
+ "knowledge-graph",
10
+ "markdown",
11
+ "semantic-annotations",
12
+ "provenance",
13
+ "prov-o",
14
+ "shacl",
15
+ "agent-memory",
16
+ "llm",
17
+ "md-ld",
18
+ "mdld",
19
+ "semantic-markdown",
20
+ "quad-store",
21
+ "crdt",
22
+ "rdfs",
23
+ "ontology",
24
+ "triple-store"
25
+ ],
5
26
  "type": "module",
6
- "packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800",
27
+ "packageManager": "pnpm@11.24.0+sha512.bd27e345e976dcb0be0b7a1228217b049a817e21b1f355c90dbe7dc46671895a8bc1e6d06c24554505ea93ea0b45f489a27ec1bfbc8de6a9659fca0f16fa0000",
7
28
  "main": "./dist/index.js",
8
29
  "exports": {
9
30
  ".": "./dist/index.js"
@@ -16,21 +37,6 @@
16
37
  "dev": "vite dev",
17
38
  "build": "vite build && vite build --config vite.config.lib.js && cp -r docs/ dist/docs/ && cp -r examples/ dist/examples/ && cp -r grammar/ dist/grammar/ && cp -r ontologies/ dist/ontologies/ && cp -r spec/ dist/spec/ && cp -r README.md dist/README.md && cp -r docs.html dist/docs.html && cp -r demo/ dist/demo/"
18
39
  },
19
- "keywords": [
20
- "mdld",
21
- "markdown",
22
- "rdf",
23
- "semantic-web",
24
- "linked-data",
25
- "n3",
26
- "rdfjs",
27
- "browser",
28
- "web-worker",
29
- "parser",
30
- "prefix-folding",
31
- "curie",
32
- "iri-authoring"
33
- ],
34
40
  "author": "davay42",
35
41
  "repository": {
36
42
  "type": "git",
@@ -41,17 +47,17 @@
41
47
  "url": "https://github.com/davay42/mdld-parse/issues"
42
48
  },
43
49
  "devDependencies": {
44
- "@unocss/extractor-pug": "^66.6.8",
45
- "@vitejs/plugin-vue": "^6.0.6",
46
- "@vueuse/core": "^14.3.0",
50
+ "@unocss/extractor-pug": "^66.8.1",
51
+ "@vitejs/plugin-vue": "^6.0.8",
52
+ "@vueuse/core": "^14.4.0",
47
53
  "codejar": "^4.3.0",
48
- "markdown-it": "^14.1.1",
49
- "n3": "^2.0.3",
50
- "shiki": "^4.0.2",
51
- "unocss": "^66.6.8",
52
- "vite": "^8.0.10",
54
+ "markdown-it": "^15.0.0",
55
+ "n3": "^2.6.0",
56
+ "shiki": "^4.4.3",
57
+ "unocss": "^66.8.1",
58
+ "vite": "^8.2.2",
53
59
  "vite-plugin-singlefile": "^2.3.3",
54
60
  "vscode-textmate": "^9.3.2",
55
- "vue": "^3.6.0-beta.10"
61
+ "vue": "^3.6.0-beta.17"
56
62
  }
57
63
  }