@ai-matrx/content-ir 0.19.15 → 0.19.17

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.17
4
+ ### Unreleased
5
+
6
+ - **Release note:** 0.19.16 was tagged but never reached npm — its tag points at a commit whose workspace lockfile (`apps/pnpm-lock.yaml`) was out of date, so every publish retry of that immutable tag fails at `pnpm install --frozen-lockfile`. The round-9 changes it carried ship in the next version.
7
+
8
+ ## 0.19.16
9
+
10
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
11
+ `git diff npm/content-ir-core/v0.19.14..npm/content-ir-core/v0.19.16 -- apps/shared/content-ir-core`).
12
+ No source changes intended and no consumer action required.
13
+
3
14
  ## 0.19.15
4
15
 
5
16
  Automatic changed-only republish (docs/metadata drift since the last tag — see
@@ -39,6 +50,7 @@ No source changes intended and no consumer action required.
39
50
  ## 0.19.9
40
51
  ### Unreleased
41
52
 
53
+ - `/source` **Round 9 verifier findings (verify-RC-B4 R9-1, R9-4, R9-5):** a footnote definition (`[^1]: …`) ends a table (Python twin moved); a table never opens INSIDE an HTML block that opened above it with no blank line (`<details>` then `| a | b |` is raw HTML — types 1–5 end at their marker, 6–7 at the blank line, 7 cannot interrupt a paragraph); new THE link-reference rule — `collectLinkDefinitions(text)`, `findLinkDefinitionLines(text)`, `resolveReferenceLinks(fragment, defs)`, `normalizeLinkLabel` — so a cell or split block resolves `[Apple Support][1]` against the document's definitions, as GFM does (a definition cannot interrupt a paragraph or a row run). Vectors +2 ends, +11 starts, +1 document.
42
54
  - `/source` **`isHtmlBlockTagName(name)`** (verify-RC-B4 round 9): the tag names CommonMark reads as an HTML BLOCK when they open a line (conditions 1 and 6: `div`, `details`, `section`, `script`, …; case-insensitive) — so a splitter can leave such a line to the markdown renderer, ending where GFM ends it, instead of opening a custom XML container that owns what follows.
43
55
  - `/source` **A table ends where GFM ends it (verify-RC-B4 round 9):** `continuesTable` / `findTableEnd` end a table at an HTML block start (all seven CommonMark 4.6 conditions — `<script`/`<pre`/`<style`/`<textarea`, `<!--`, `<?`, `<!X`, `<![CDATA[`, a block tag name, or any other complete tag alone on its line such as `</artifact>`) and at indented code: a line 4+ columns past the table's container. New `startsHtmlBlock`, `lineIndent`, `tableContainerIndent` (the content column of the list item a table sits in); `continuesTable(line, containerIndent = 0)`. A lone `|` is a row (one empty cell) — `rowCells("|")` is `[""]`, no longer `[]`. Since 0.19.4 an HTML line or an indented line after a table was read as a table row. Shared vectors gain `tableEnds` (30 cases, each judged against remark-gfm in matrx-frontend); the Python twin moved with them.
44
56
  - `/source` **A table never opens on a lazy continuation line (verify-RC-B4 round 9):** `opensTable` / `tableStartsAt` / `findTableStart` refuse a header that lazily continues a list item's or a block quote's paragraph (no blank line above, not indented to the item's content column, or missing the quote's `>`) — GFM reads it as paragraph text (`- item` then `| a | b |` is no table). Vectors gain `tableStarts` (15 cases, judged against remark-gfm).
package/dist/index.cjs CHANGED
@@ -7672,20 +7672,36 @@ function normalizeLinkLabel(label) {
7672
7672
  var DEFINITION = /^ {0,3}\[((?:[^\]\\]|\\.){1,999})\]:[ \t]*(?:<([^<>\n]*)>|(\S+))(?:[ \t]+(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'|\(((?:[^()\\]|\\.)*)\)))?[ \t]*$/;
7673
7673
  function collectLinkDefinitions(text) {
7674
7674
  const defs = /* @__PURE__ */ new Map();
7675
- if (!text.includes("]:")) return defs;
7675
+ for (const { label, definition } of scanLinkDefinitions(text)) {
7676
+ const key = normalizeLinkLabel(label);
7677
+ if (key && !defs.has(key)) defs.set(key, definition);
7678
+ }
7679
+ return defs;
7680
+ }
7681
+ function findLinkDefinitionLines(text) {
7682
+ return scanLinkDefinitions(text).map(({ line }) => line);
7683
+ }
7684
+ function scanLinkDefinitions(text) {
7685
+ const found = [];
7686
+ if (!text.includes("]:")) return found;
7676
7687
  const lines = text.split("\n");
7677
7688
  const kinds = fenceLineKinds(text);
7689
+ let previousWasDefinition = false;
7678
7690
  lines.forEach((line, i) => {
7691
+ const wasDefinition = previousWasDefinition;
7692
+ previousWasDefinition = false;
7679
7693
  if (kinds[i] !== "prose") return;
7680
7694
  const m = DEFINITION.exec(line);
7681
7695
  if (!m) return;
7696
+ const above = i > 0 ? lines[i - 1] ?? "" : "";
7697
+ const opensBlock = i === 0 || !above.trim() || wasDefinition || kinds[i - 1] === "close" || /^ {0,3}(?:#{1,6}(?:\s|$)|(?:[-*_][ \t]*){3,}$)/.test(above);
7698
+ if (!opensBlock) return;
7682
7699
  const label = m[1] ?? "";
7683
7700
  if (label.startsWith("^")) return;
7684
- const key = normalizeLinkLabel(label);
7685
- if (!key || defs.has(key)) return;
7686
- defs.set(key, { url: m[2] ?? m[3] ?? "", title: m[4] ?? m[5] ?? m[6] ?? null });
7701
+ previousWasDefinition = true;
7702
+ found.push({ line: i, label, definition: { url: m[2] ?? m[3] ?? "", title: m[4] ?? m[5] ?? m[6] ?? null } });
7687
7703
  });
7688
- return defs;
7704
+ return found;
7689
7705
  }
7690
7706
  var REFERENCE = /(!?)\[((?:[^\]\\]|\\.)*)\](?:\[((?:[^\]\\]|\\.)*)\])?(?![(:[])/g;
7691
7707
  var escapeTitle = (title) => title.replace(/["\\]/g, "\\$&");
@@ -7984,6 +8000,7 @@ exports.fenceParts = fenceParts;
7984
8000
  exports.fieldsToDbPayload = fieldsToDbPayload;
7985
8001
  exports.findCodeRanges = findCodeRanges;
7986
8002
  exports.findInlineCodeSpans = findInlineCodeSpans;
8003
+ exports.findLinkDefinitionLines = findLinkDefinitionLines;
7987
8004
  exports.findTableEnd = findTableEnd;
7988
8005
  exports.findTableStart = findTableStart;
7989
8006
  exports.fingerprintText = fingerprintText;