@abraca/mcp 1.8.1 → 1.9.1

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.
@@ -21820,14 +21820,12 @@ function parseInline(text) {
21820
21820
  text: kbdProps["value"] || "",
21821
21821
  attrs: { kbd: { value: kbdProps["value"] || "" } }
21822
21822
  });
21823
- } else if (match[5] !== void 0) {
21824
- const docId = match[5];
21825
- const displayText = match[6] ?? docId;
21826
- tokens.push({
21827
- text: displayText,
21828
- attrs: { link: { href: `/doc/${docId}` } }
21829
- });
21830
- } else if (match[7] !== void 0) tokens.push({
21823
+ } else if (match[5] !== void 0) tokens.push({
21824
+ text: "",
21825
+ node: "docLink",
21826
+ nodeAttrs: { docId: match[5] }
21827
+ });
21828
+ else if (match[7] !== void 0) tokens.push({
21831
21829
  text: match[7],
21832
21830
  attrs: { strike: true }
21833
21831
  });
@@ -21854,7 +21852,7 @@ function parseInline(text) {
21854
21852
  lastIndex = match.index + match[0].length;
21855
21853
  }
21856
21854
  if (lastIndex < stripped.length) tokens.push({ text: stripped.slice(lastIndex) });
21857
- return tokens.filter((t) => t.text.length > 0);
21855
+ return tokens.filter((t) => t.node || t.text.length > 0);
21858
21856
  }
21859
21857
  function parseTableRow(line) {
21860
21858
  const parts = line.split("|");
@@ -21982,11 +21980,14 @@ function parseBlocks(markdown) {
21982
21980
  i++;
21983
21981
  continue;
21984
21982
  }
21985
- const docEmbedMatch = line.match(/^!\[\[([^\]|]+?)(?:\|[^\]]*?)?\]\]\s*$/);
21983
+ const docEmbedMatch = line.match(/^!\[\[([^\]|]+?)(?:\|[^\]]*?)?\]\](\{[^}]*\})?\s*$/);
21986
21984
  if (docEmbedMatch) {
21985
+ const props = parseMdcProps(docEmbedMatch[2]);
21986
+ const seamless = "seamless" in props || props["seamless"] === "true" || /\{[^}]*\bseamless\b[^}]*\}/.test(docEmbedMatch[2] ?? "");
21987
21987
  blocks.push({
21988
21988
  type: "docEmbed",
21989
- docId: docEmbedMatch[1]
21989
+ docId: docEmbedMatch[1],
21990
+ seamless: seamless || void 0
21990
21991
  });
21991
21992
  i++;
21992
21993
  continue;
@@ -22264,13 +22265,22 @@ function parseBlocks(markdown) {
22264
22265
  return blocks;
22265
22266
  }
22266
22267
  function fillTextInto(el, tokens) {
22267
- const filtered = tokens.filter((t) => t.text.length > 0);
22268
+ const filtered = tokens.filter((t) => t.node || t.text.length > 0);
22268
22269
  if (!filtered.length) return;
22269
- const xtNodes = filtered.map(() => new Y.XmlText());
22270
- el.insert(0, xtNodes);
22270
+ const children = filtered.map((tok) => {
22271
+ if (tok.node) {
22272
+ const xe = new Y.XmlElement(tok.node);
22273
+ if (tok.nodeAttrs) for (const [k, v] of Object.entries(tok.nodeAttrs)) xe.setAttribute(k, v);
22274
+ return xe;
22275
+ }
22276
+ return new Y.XmlText();
22277
+ });
22278
+ el.insert(0, children);
22271
22279
  filtered.forEach((tok, i) => {
22272
- if (tok.attrs) xtNodes[i].insert(0, tok.text, tok.attrs);
22273
- else xtNodes[i].insert(0, tok.text);
22280
+ if (tok.node) return;
22281
+ const xt = children[i];
22282
+ if (tok.attrs) xt.insert(0, tok.text, tok.attrs);
22283
+ else xt.insert(0, tok.text);
22274
22284
  });
22275
22285
  }
22276
22286
  function blockElName(b) {
@@ -22517,6 +22527,7 @@ function fillBlock(el, block) {
22517
22527
  break;
22518
22528
  case "docEmbed":
22519
22529
  el.setAttribute("docId", block.docId);
22530
+ if (block.seamless) el.setAttribute("seamless", "true");
22520
22531
  break;
22521
22532
  case "svgEmbed":
22522
22533
  el.setAttribute("svg", block.svg);
@@ -22616,7 +22627,14 @@ function elementTextContent(el) {
22616
22627
  for (let i = 0; i < el.length; i++) {
22617
22628
  const child = el.get(i);
22618
22629
  if (child instanceof Y.XmlText) parts.push(xmlTextToMarkdown(child));
22619
- else if (child instanceof Y.XmlElement) parts.push(elementTextContent(child));
22630
+ else if (child instanceof Y.XmlElement) {
22631
+ if (child.nodeName === "docLink") {
22632
+ const docId = child.getAttribute("docId");
22633
+ if (docId) parts.push(`[[${docId}]]`);
22634
+ continue;
22635
+ }
22636
+ parts.push(elementTextContent(child));
22637
+ }
22620
22638
  }
22621
22639
  return parts.join("");
22622
22640
  }
@@ -22645,7 +22663,9 @@ function serializeElement(el, indent = "") {
22645
22663
  case "table": return serializeTable(el);
22646
22664
  case "docEmbed": {
22647
22665
  const docId = el.getAttribute("docId");
22648
- return docId ? `![[${docId}]]` : "";
22666
+ if (!docId) return "";
22667
+ const seamlessAttr = el.getAttribute("seamless");
22668
+ return seamlessAttr === true || seamlessAttr === "true" ? `![[${docId}]]{seamless}` : `![[${docId}]]`;
22649
22669
  }
22650
22670
  case "svgEmbed": {
22651
22671
  const svg = el.getAttribute("svg") || "";