mdld-parse 1.0.5 → 1.0.7

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 +11 -0
  2. package/dist/index.js +80 -83
  3. package/package.json +10 -10
package/README.md CHANGED
@@ -352,6 +352,10 @@ Parse MDLD to RDF quads with lean origin tracking.
352
352
  - `primary` — Primary metadata quartet: `{ subject, type, label, comment }`
353
353
  - `md` — Clean Markdown with annotations stripped
354
354
 
355
+ `primarySubject` is useful to allow each iri have it's page and vice versa - so we can have arbitrary MD content attached to it. This is where we can render the `md` on the entity page if we have it in our custom `const pages = new Map()`.
356
+
357
+ `md` is useful to detect parsing success: `if(originalText!=parsed.md) {console.log('Parse success. Total annotations: ', originalText.length-md.length) letters.`
358
+
355
359
  ### `merge(docs, options)`
356
360
 
357
361
  Merge multiple MDLD documents with diff polarity resolution.
@@ -517,9 +521,11 @@ Comprehensive test suite covering:
517
521
  - [Formal Specification](./spec/Spec.md)
518
522
  - [Compact Spec](./spec/Spec-compact.md)
519
523
  - [Ultra Compact Spec](./spec/Spec-ultra.md)
524
+
520
525
  - **📚 [Grammar](./grammar/index.md)** — EBNF+TextMate grammar specifications
521
526
  - [The TextMate grammar](./grammar/mdld.tmLanguage.json)
522
527
  - [ISO 14977 EBNF grammar](./grammar/mdld.ebnf)
528
+
523
529
  - **📖 [Documentation](./docs/index.md)** — Complete documentation with guides and references
524
530
  - [MD-LD Authoring Guide](./docs/Guide.md)
525
531
  - [One Page Guide](./docs/one-page.md)
@@ -541,6 +547,7 @@ Comprehensive test suite covering:
541
547
  - [Human-Scale Software & Semantic Infrastructure](./docs/Human-Scale.md)
542
548
  - [Quad[] as a Universal Semantic Runtime](./docs/quad-runtime.md)
543
549
  - [Use Cases](./docs/Use-Cases.md)
550
+
544
551
  - **🎯 [Examples](./examples/index.md)** — Real-world MD-LD examples and use cases
545
552
  - [Minimal](./examples/demo/minimal.md)
546
553
  - [One-Page Guide](./examples/one-page.md)
@@ -560,6 +567,10 @@ Comprehensive test suite covering:
560
567
  - [LLM Time Workflow](./examples/llm-time-workflow.md)
561
568
  - [Research Workflow](./examples/workflow.md)
562
569
  - [Dogfood](./examples/dogfood.md)
570
+
571
+ - **💻 [Reference server](./server/index.md) - a Node.js implementation of the server for git-powered semantic workflows and publishing
572
+ - [Source code](./server/mdld-server.js)
573
+
563
574
  - **🧩 [Ontologies](./ontologies/index.md)** — W3C and related standard ontologies used in RDF
564
575
  - [RDF — Resource Description Framework](./ontologies/rdf.md)
565
576
  - [RDFS — RDF Schema](./ontologies/rdfs.md)
package/dist/index.js CHANGED
@@ -1060,6 +1060,7 @@ function parse(firstArg, secondArg = {}) {
1060
1060
  primarySubject: null,
1061
1061
  primaryType: null,
1062
1062
  primaryLabel: null,
1063
+ primaryComment: null,
1063
1064
  tokens: null,
1064
1065
  currentTokenIndex: -1,
1065
1066
  statements: [],
@@ -1088,12 +1089,11 @@ function parse(firstArg, secondArg = {}) {
1088
1089
  }
1089
1090
  TOKEN_PROCESSORS[token.type]?.(token, state);
1090
1091
  }
1091
- const quadKeys = /* @__PURE__ */ new Set();
1092
- for (const quad of state.quads) quadKeys.add(quadIndexKey(quad.subject, quad.predicate, quad.object));
1092
+ state.quads = Array.from(state.quadBuffer.values());
1093
1093
  const filteredRemove = [];
1094
1094
  for (const quad of state.removeSet) {
1095
1095
  const key = quadIndexKey(quad.subject, quad.predicate, quad.object);
1096
- if (!quadKeys.has(key)) filteredRemove.push(quad);
1096
+ if (!state.quadBuffer.has(key)) filteredRemove.push(quad);
1097
1097
  }
1098
1098
  const primary = {
1099
1099
  subject: state.primarySubject,
@@ -1114,7 +1114,8 @@ function parse(firstArg, secondArg = {}) {
1114
1114
  }
1115
1115
  function getCarriers(token) {
1116
1116
  if (token.type === "code") return [];
1117
- return token._carriers || (token._carriers = extractInlineCarriers(token.text, token.range[0]));
1117
+ const baseOffset = token.valueRange ? token.valueRange[0] : token.range[0];
1118
+ return token._carriers || (token._carriers = extractInlineCarriers(token.text, baseOffset));
1118
1119
  }
1119
1120
  function scanTokens(text) {
1120
1121
  const tokens = [];
@@ -1244,7 +1245,7 @@ function scanTokens(text) {
1244
1245
  const valueEnd = Math.max(valueStart, lineStart - 1);
1245
1246
  tokens.push({
1246
1247
  type: "code",
1247
- range: [codeBlock.start, lineStart],
1248
+ range: [codeBlock.start, pos - 1],
1248
1249
  text: codeBlock.content.join("\n"),
1249
1250
  lang: codeBlock.lang,
1250
1251
  attrs: codeBlock.attrs,
@@ -1304,17 +1305,38 @@ function scanTokens(text) {
1304
1305
  return true;
1305
1306
  }
1306
1307
  function handlePara(line, lineStart, pos) {
1307
- tokens.push(createToken("para", [lineStart, pos - 1], line.trim()));
1308
+ const leadingWhitespace = line.search(/\S/);
1309
+ const valueStart = leadingWhitespace === -1 ? lineStart : lineStart + leadingWhitespace;
1310
+ const trimmed = line.trim();
1311
+ const valueEnd = valueStart + trimmed.length;
1312
+ tokens.push(createToken("para", [lineStart, pos - 1], trimmed, null, null, [valueStart, valueEnd]));
1308
1313
  let cleanPara = line;
1314
+ const codeSpans = [];
1315
+ cleanPara = cleanPara.replace(/`[^`]+`/g, (match) => {
1316
+ codeSpans.push(match);
1317
+ return `__INLINE_CODE_${codeSpans.length - 1}__`;
1318
+ });
1319
+ const mustaches = [];
1320
+ cleanPara = cleanPara.replace(/\{\{(?:[^{}]|\{[^{}]*\})*\}\}/g, (match) => {
1321
+ mustaches.push(match);
1322
+ return `__VUE_INTERPOLATION_${mustaches.length - 1}__`;
1323
+ });
1309
1324
  const carriers = scanInlineCarriers(cleanPara, 0);
1310
- for (const carrier of carriers) if (carrier.attrs && (carrier.type === "emphasis" || carrier.type === "code")) {
1311
- const before = cleanPara.substring(0, carrier.range[0]);
1312
- const after = cleanPara.substring(carrier.range[1]);
1313
- cleanPara = before + (carrier.text || "") + after;
1325
+ for (let i = carriers.length - 1; i >= 0; i--) {
1326
+ const carrier = carriers[i];
1327
+ if (carrier.attrs && (carrier.type === "emphasis" || carrier.type === "code")) {
1328
+ const before = cleanPara.substring(0, carrier.range[0]);
1329
+ const after = cleanPara.substring(carrier.range[1]);
1330
+ cleanPara = before + (carrier.text || "") + after;
1331
+ }
1314
1332
  }
1315
1333
  cleanPara = cleanPara.replace(/\[([^\]]+)\]\s*\{[^}]+\}/g, "$1");
1316
- cleanPara = cleanPara.replace(/\s*\{[^}]+\}\s*/g, " ");
1317
- cleanPara = cleanPara.replace(/\s+/g, " ").trim();
1334
+ cleanPara = cleanPara.replace(/([^{]|^)\{[^{}]+\}(?=[^}]|$)/g, "$1");
1335
+ cleanPara = cleanPara.replace(/__VUE_INTERPOLATION_(\d+)__/g, (_, idx) => mustaches[Number(idx)]);
1336
+ cleanPara = cleanPara.replace(/__INLINE_CODE_(\d+)__/g, (_, idx) => codeSpans[Number(idx)]);
1337
+ const trailingSpaces = cleanPara.match(/ {2,}$/);
1338
+ if (trailingSpaces) cleanPara = cleanPara.replace(/[ \t]+$/, trailingSpaces[0]);
1339
+ else cleanPara = cleanPara.replace(/[ \t]+$/, "");
1318
1340
  mdLines.push(cleanPara);
1319
1341
  return true;
1320
1342
  }
@@ -1500,33 +1522,35 @@ function createBlock(subject, types, predicates, range, attrsRange, valueRange,
1500
1522
  text: text || ""
1501
1523
  };
1502
1524
  }
1503
- function emitQuad(quads, quadBuffer, removeSet, quadIndex, block, subject, predicate, object, dataFactory, meta = null, statements = null, statementCandidates = null, state = null) {
1525
+ /**
1526
+ * Hardened O(1) quad emitter.
1527
+ * Uses state.quadBuffer (Map) as single source of truth during parsing.
1528
+ */
1529
+ function emitQuad(state, block, subject, predicate, object, meta = null) {
1504
1530
  if (!subject || !predicate || !object) return;
1505
- const quad = dataFactory.quad(subject, predicate, object);
1506
- if (meta?.remove || false) {
1507
- const quadKey = quadIndexKey(quad.subject, quad.predicate, quad.object);
1508
- if (quadBuffer.has(quadKey)) {
1509
- quadBuffer.delete(quadKey);
1510
- const index = quads.findIndex((q) => q.subject.value === quad.subject.value && q.predicate.value === quad.predicate.value && q.object.value === quad.object.value);
1511
- if (index !== -1) quads.splice(index, 1);
1512
- quadIndex.delete(quadKey);
1513
- } else removeSet.add(quad);
1514
- } else {
1515
- const quadKey = quadIndexKey(quad.subject, quad.predicate, quad.object);
1516
- quadBuffer.set(quadKey, quad);
1517
- quads.push(quad);
1518
- if (state) {
1519
- if (!state.primaryType && predicate.value === "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") state.primaryType = object.value;
1520
- if (!state.primaryLabel && predicate.value === "http://www.w3.org/2000/01/rdf-schema#label" && object.termType === "Literal") state.primaryLabel = object.value;
1521
- if (!state.primaryComment && predicate.value === "http://www.w3.org/2000/01/rdf-schema#comment" && object.termType === "Literal") state.primaryComment = object.value;
1522
- }
1523
- detectStatementPatternSinglePass(quad, dataFactory, meta, statements, statementCandidates);
1524
- const originEntry = createLeanOriginEntry(block, subject, predicate, meta);
1525
- quadIndex.set(quadKey, originEntry);
1526
- if (state.currentBlock && block.id === state.currentBlock.id) {
1527
- if (!state.currentBlock.quadKeys) state.currentBlock.quadKeys = [];
1528
- state.currentBlock.quadKeys.push(quadKey);
1531
+ const quadKey = quadIndexKey(subject, predicate, object);
1532
+ if (Boolean(meta?.remove)) {
1533
+ if (state.quadBuffer.has(quadKey)) {
1534
+ state.quadBuffer.delete(quadKey);
1535
+ state.origin.quadIndex.delete(quadKey);
1536
+ } else {
1537
+ const retractQuad = state.df.quad(subject, predicate, object, state.graph);
1538
+ state.removeSet.add(retractQuad);
1529
1539
  }
1540
+ return;
1541
+ }
1542
+ const quad = state.df.quad(subject, predicate, object, state.graph);
1543
+ state.quadBuffer.set(quadKey, quad);
1544
+ const predVal = predicate.value;
1545
+ if (!state.primaryType && predVal === "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") state.primaryType = object.value;
1546
+ else if (!state.primaryLabel && predVal === "http://www.w3.org/2000/01/rdf-schema#label" && object.termType === "Literal") state.primaryLabel = object.value;
1547
+ else if (!state.primaryComment && predVal === "http://www.w3.org/2000/01/rdf-schema#comment" && object.termType === "Literal") state.primaryComment = object.value;
1548
+ if (state.statements && state.statementCandidates) detectStatementPatternSinglePass(quad, state.df, meta, state.statements, state.statementCandidates);
1549
+ const originEntry = createLeanOriginEntry(block, subject, predicate, meta);
1550
+ state.origin.quadIndex.set(quadKey, originEntry);
1551
+ if (block && state.currentBlock && block.id === state.currentBlock.id) {
1552
+ if (!state.currentBlock.quadKeys) state.currentBlock.quadKeys = [];
1553
+ state.currentBlock.quadKeys.push(quadKey);
1530
1554
  }
1531
1555
  }
1532
1556
  function detectStatementPatternSinglePass(quad, dataFactory, meta, statements = null, statementCandidates = null) {
@@ -1557,13 +1581,13 @@ var createTypeQuad = (typeIRI, subject, state, block, entryIndex = null) => {
1557
1581
  entryIndex,
1558
1582
  remove: false
1559
1583
  };
1560
- emitQuad(state.quads, state.quadBuffer, state.removeSet, state.origin.quadIndex, block, subject, state.df.namedNode(expandIRI("rdf:type", state.ctx)), state.df.namedNode(expandedType), state.df, {
1584
+ emitQuad(state, block, subject, state.df.namedNode(expandIRI("rdf:type", state.ctx)), state.df.namedNode(expandedType), {
1561
1585
  kind: "type",
1562
1586
  token: `.${typeIRI}`,
1563
1587
  expandedType,
1564
1588
  entryIndex: typeInfo.entryIndex,
1565
1589
  remove: typeInfo.remove
1566
- }, state.statements, state.statementCandidates, state);
1590
+ });
1567
1591
  };
1568
1592
  function processTypeAnnotations(sem, newSubject, localObject, carrierO, S, block, state, carrier) {
1569
1593
  sem.types.forEach((t) => {
@@ -1602,14 +1626,14 @@ function processPredicateAnnotations(sem, newSubject, previousSubject, localObje
1602
1626
  const role = determinePredicateRole(pred, carrier, newSubject, previousSubject, localObject, newSubjectOrCarrierO, S, L);
1603
1627
  if (role) {
1604
1628
  const P = state.df.namedNode(expandIRI(pred.iri, state.ctx));
1605
- emitQuad(state.quads, state.quadBuffer, state.removeSet, state.origin.quadIndex, block, role.subject, P, role.object, state.df, {
1629
+ emitQuad(state, block, role.subject, P, role.object, {
1606
1630
  kind: "pred",
1607
1631
  token: `${pred.form}${pred.iri}`,
1608
1632
  form: pred.form,
1609
1633
  expandedPredicate: P.value,
1610
1634
  entryIndex: pred.entryIndex,
1611
1635
  remove: pred.remove || false
1612
- }, state.statements, state.statementCandidates, state);
1636
+ });
1613
1637
  }
1614
1638
  });
1615
1639
  }
@@ -1636,11 +1660,12 @@ function processStandaloneSubject(token, state) {
1636
1660
  if (!result) return;
1637
1661
  const sem = parseSemCached(`{=${result.content}}`);
1638
1662
  const attrsStart = token.range[0] + token.text.indexOf("{=");
1663
+ const fullAttrLength = 3 + (result.content ? result.content.length : 0);
1639
1664
  processAnnotation({
1640
1665
  type: "standalone",
1641
1666
  text: "",
1642
1667
  range: token.range,
1643
- attrsRange: [attrsStart, attrsStart + (result.content ? result.content.length : 0)],
1668
+ attrsRange: [attrsStart, attrsStart + fullAttrLength],
1644
1669
  valueRange: null
1645
1670
  }, sem, state);
1646
1671
  }
@@ -1816,13 +1841,15 @@ function generateNode({ quads, focusIRI, context = {}, compactInline = true, ren
1816
1841
  compactStats: null
1817
1842
  };
1818
1843
  const fullContext = Object.assign({}, DEFAULT_CONTEXT, context);
1819
- const { nodeGroups, reverseIndex } = groupQuadsByNode(normalizeAndSortQuads(quads));
1820
- if (!nodeGroups.has(focusIRI)) return {
1844
+ const normalizedQuads = normalizeAndSortQuads(quads.filter((q) => q.subject.value === focusIRI || q.predicate.value === focusIRI || q.object.value === focusIRI || q.object.termType === "Literal" && q.object.datatype && (q.object.datatype.value || q.object.datatype) === focusIRI));
1845
+ const { subjectGroups: nodeGroups, reverseIndex } = groupQuadsBySubject(normalizedQuads);
1846
+ const subjectRoots = Array.from(new Set(normalizedQuads.map((q) => q.subject.value)));
1847
+ if (subjectRoots.length === 0) return {
1821
1848
  text: "",
1822
1849
  context: fullContext,
1823
1850
  compactStats: null
1824
1851
  };
1825
- const { text, compactStats } = buildDeterministicMDLD(nodeGroups, fullContext, focusIRI, renderReverse ? reverseIndex : null, compactInline, /* @__PURE__ */ new Map(), lang);
1852
+ const { text, compactStats } = buildDeterministicMDLD(nodeGroups, fullContext, subjectRoots.includes(focusIRI) ? focusIRI : subjectRoots[0], renderReverse ? reverseIndex : null, compactInline, /* @__PURE__ */ new Map(), lang);
1826
1853
  return {
1827
1854
  text,
1828
1855
  context: fullContext,
@@ -1868,36 +1895,7 @@ function groupQuadsBySubject(quads) {
1868
1895
  reverseIndex
1869
1896
  };
1870
1897
  }
1871
- function groupQuadsByNode(quads) {
1872
- const groups = /* @__PURE__ */ new Map();
1873
- const reverseIndex = /* @__PURE__ */ new Map();
1874
- const ensure = (key) => {
1875
- const existing = groups.get(key);
1876
- if (existing) return existing;
1877
- const newArray = [];
1878
- groups.set(key, newArray);
1879
- return newArray;
1880
- };
1881
- for (const quad of quads) {
1882
- const { subject, predicate, object } = quad;
1883
- ensure(subject.value).push(quad);
1884
- if (object.termType === "NamedNode") {
1885
- ensure(object.value).push(quad);
1886
- const objectValue = object.value;
1887
- const reverseList = reverseIndex.get(objectValue);
1888
- if (reverseList) reverseList.push(quad);
1889
- else reverseIndex.set(objectValue, [quad]);
1890
- }
1891
- ensure(predicate.value).push(quad);
1892
- if (predicate.value === "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" && object.termType === "NamedNode") ensure(object.value).push(quad);
1893
- if (object.termType === "Literal" && object.datatype) ensure(object.datatype.value || object.datatype).push(quad);
1894
- }
1895
- return {
1896
- nodeGroups: groups,
1897
- reverseIndex
1898
- };
1899
- }
1900
- function buildDeterministicMDLD(subjectGroups, context, primarySubject = null, reverseIndex = null, compactInline = true, removeBySubject = /* @__PURE__ */ new Map(), lang = null) {
1898
+ function buildDeterministicMDLD(subjectGroups, context, primarySubjectIRI = null, reverseIndex = null, compactInline = true, removeBySubject = /* @__PURE__ */ new Map(), lang = null) {
1901
1899
  const textParts = [];
1902
1900
  const usedPrefixes = collectUsedPrefixes(subjectGroups, context);
1903
1901
  const labelLookup = buildLabelLookup(subjectGroups, lang);
@@ -1913,7 +1911,6 @@ function buildDeterministicMDLD(subjectGroups, context, primarySubject = null, r
1913
1911
  for (const [prefix, namespace] of sortedPrefixes) if (prefix !== "@vocab" && !prefix.startsWith("@") && !DEFAULT_CONTEXT[prefix] && usedPrefixes.has(prefix)) textParts.push(generatePrefixDeclaration(prefix, namespace));
1914
1912
  if (sortedPrefixes.length > 0) textParts.push("\n");
1915
1913
  const sortedSubjects = Array.from(subjectGroups.keys()).sort();
1916
- const primarySubjectIRI = primarySubject;
1917
1914
  const orderedSubjects = primarySubjectIRI ? [primarySubjectIRI, ...sortedSubjects.filter((s) => s !== primarySubjectIRI)] : sortedSubjects;
1918
1915
  for (const subjectIRI of orderedSubjects) {
1919
1916
  const subjectQuads = subjectGroups.get(subjectIRI);
@@ -1936,7 +1933,7 @@ function buildDeterministicMDLD(subjectGroups, context, primarySubject = null, r
1936
1933
  annotations += (annotations ? " " : "") + "label" + langTag;
1937
1934
  }
1938
1935
  const annotationStr = annotations ? " " + annotations : "";
1939
- textParts.push(`# ${displayName} {=${shortSubject}${annotationStr}}\n`);
1936
+ textParts.push(`## ${displayName} {=${shortSubject}${annotationStr}}\n`);
1940
1937
  types.forEach((t) => renderedQuads.add(t));
1941
1938
  if (labelQuad) renderedQuads.add(labelQuad);
1942
1939
  const headingLabel = hasLabel ? labelEntry.value : null;
@@ -1992,7 +1989,7 @@ function buildDeterministicMDLD(subjectGroups, context, primarySubject = null, r
1992
1989
  for (const [subjectIRI, removeQuads] of removeBySubject) {
1993
1990
  const shortSubject = getCachedShortIRI(subjectIRI, context);
1994
1991
  const displayName = extractLocalName(subjectIRI, context);
1995
- textParts.push(`# ${displayName} {=${shortSubject}}\n`);
1992
+ textParts.push(`### ${displayName} {=${shortSubject}}\n`);
1996
1993
  for (const quad of removeQuads) textParts.push(generateRetractionText(quad, context));
1997
1994
  textParts.push("\n");
1998
1995
  }
@@ -2171,7 +2168,7 @@ function renderTerm(part, isRetracted, prefixes) {
2171
2168
  const prefixColor = getIRIColor(prefixIRI);
2172
2169
  const fullIRI = prefixIRI + local;
2173
2170
  const localColor = getIRIColor(fullIRI);
2174
- return `<span style="color: ${prefixColor}">${escapeHtml(prefix)}</span><span style="color: ${TOKEN_COLORS.marker}">:</span><span data-iri="${fullIRI}" style="color: ${localColor}">${escapeHtml(local)}</span> `;
2171
+ return `<span data-iri="${fullIRI}"><span style="color: ${prefixColor}">${escapeHtml(prefix)}</span><span style="color: ${TOKEN_COLORS.marker}">:</span><span style="color: ${localColor}">${escapeHtml(local)}</span></span> `;
2175
2172
  }
2176
2173
  }
2177
2174
  if (part.startsWith("http:") || part.startsWith("https:") || part.startsWith("tag:") || part.startsWith("urn:")) return `<span style="color: ${getIRIColor(part)}">${escapeHtml(part)}</span> `;
@@ -2247,9 +2244,9 @@ function highlightMDLD(code) {
2247
2244
  continue;
2248
2245
  }
2249
2246
  const parsed = parseAnnotation(code.slice(i + 1, endIdx), prefixes);
2250
- result += `<span style="color: ${TOKEN_COLORS.annotation}; opacity: 0.75">{</span>`;
2247
+ result += `<span class="mdld-annotation"><span style="color: ${TOKEN_COLORS.annotation}; opacity: 0.75">{</span>`;
2251
2248
  result += parsed;
2252
- result += `<span style="color: ${TOKEN_COLORS.annotation}; opacity: 0.75">}</span>`;
2249
+ result += `<span style="color: ${TOKEN_COLORS.annotation}; opacity: 0.75">}</span></span>`;
2253
2250
  i = endIdx + 1;
2254
2251
  continue;
2255
2252
  }
@@ -2276,7 +2273,7 @@ function highlightMDLD(code) {
2276
2273
  const content = code.slice(i + 1, endBracket);
2277
2274
  const bracketColor = hasFollowingAnnotation(code, endBracket + 1) ? TOKEN_COLORS.marker : TOKEN_COLORS.value;
2278
2275
  const escapedContent = escapeHtml(content);
2279
- result += `<span style="color: ${bracketColor}; opacity: 0.85">[</span><span style=" opacity: 1.0">${escapedContent}</span><span style="color: ${bracketColor}; opacity: 0.85">]</span>`;
2276
+ result += `<span style="color: ${bracketColor}; opacity: 0.85">[</span><span style="background-color: ${bracketColor}15">${escapedContent}</span><span style="color: ${bracketColor}; opacity: 0.85">]</span>`;
2280
2277
  i = endBracket + 1;
2281
2278
  continue;
2282
2279
  }
@@ -2308,7 +2305,7 @@ function highlightMDLD(code) {
2308
2305
  const beforeText = headerText.slice(lastIndex, annotationStart);
2309
2306
  processedHeaderText += escapeHtml(beforeText);
2310
2307
  const parsedAnnotation = parseAnnotation(headerText.slice(annotationStart + 1, annotationEnd), prefixes);
2311
- processedHeaderText += `<span style="color: ${TOKEN_COLORS.annotation}; opacity: 0.75">{</span>` + parsedAnnotation + `<span style="color: ${TOKEN_COLORS.annotation}; opacity: 0.75">}</span>`;
2308
+ processedHeaderText += `<span class="mdld-annotation"><span style="color: ${TOKEN_COLORS.annotation}; opacity: 0.75">{</span>` + parsedAnnotation + `<span style="color: ${TOKEN_COLORS.annotation}; opacity: 0.75">}</span></span>`;
2312
2309
  lastIndex = annotationEnd + 1;
2313
2310
  annotationStart = headerText.indexOf("{", lastIndex);
2314
2311
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdld-parse",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Write RDF knowledge graphs as plain Markdown. Parse to quads, generate back, merge documents. The human-friendly semantic web format.",
5
5
  "keywords": [
6
6
  "rdf",
@@ -24,7 +24,6 @@
24
24
  "triple-store"
25
25
  ],
26
26
  "type": "module",
27
- "packageManager": "pnpm@11.24.0+sha512.bd27e345e976dcb0be0b7a1228217b049a817e21b1f355c90dbe7dc46671895a8bc1e6d06c24554505ea93ea0b45f489a27ec1bfbc8de6a9659fca0f16fa0000",
28
27
  "main": "./dist/index.js",
29
28
  "exports": {
30
29
  ".": "./dist/index.js"
@@ -35,7 +34,7 @@
35
34
  "scripts": {
36
35
  "test": "node tests/index.js",
37
36
  "dev": "vite dev",
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/"
37
+ "build": "vite build && vite build --config vite.config.lib.js && cp -r docs/ dist/docs/ && cp -r server/ dist/server/ && 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/ && cp -r src/ dist/src/"
39
38
  },
40
39
  "author": "davay42",
41
40
  "repository": {
@@ -47,17 +46,18 @@
47
46
  "url": "https://github.com/davay42/mdld-parse/issues"
48
47
  },
49
48
  "devDependencies": {
50
- "@unocss/extractor-pug": "^66.8.1",
49
+ "@unocss/extractor-pug": "^66.10.2",
51
50
  "@vitejs/plugin-vue": "^6.0.8",
52
51
  "@vueuse/core": "^14.4.0",
53
52
  "codejar": "^4.3.0",
54
- "markdown-it": "^15.0.0",
55
- "n3": "^2.6.0",
53
+ "markdown-it": "^15.0.2",
54
+ "n3": "^2.7.12",
56
55
  "shiki": "^4.4.3",
57
- "unocss": "^66.8.1",
58
- "vite": "^8.2.2",
56
+ "unocss": "^66.10.2",
57
+ "vite": "^8.3.0",
59
58
  "vite-plugin-singlefile": "^2.3.3",
60
59
  "vscode-textmate": "^9.3.2",
61
60
  "vue": "^3.6.0-beta.17"
62
- }
63
- }
61
+ },
62
+ "packageManager": "pnpm@11.26.0+sha512.fc0e2bf890b9f983611f1ab68c0637bce914390653699f83c1a78b005ed25f2c81e77920c8fd8eee2ecf0b58b28cdcb00a84d97f69bcf7c56b2f344710238664"
63
+ }