@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.
@@ -21824,14 +21824,12 @@ function parseInline(text) {
21824
21824
  text: kbdProps["value"] || "",
21825
21825
  attrs: { kbd: { value: kbdProps["value"] || "" } }
21826
21826
  });
21827
- } else if (match[5] !== void 0) {
21828
- const docId = match[5];
21829
- const displayText = match[6] ?? docId;
21830
- tokens.push({
21831
- text: displayText,
21832
- attrs: { link: { href: `/doc/${docId}` } }
21833
- });
21834
- } else if (match[7] !== void 0) tokens.push({
21827
+ } else if (match[5] !== void 0) tokens.push({
21828
+ text: "",
21829
+ node: "docLink",
21830
+ nodeAttrs: { docId: match[5] }
21831
+ });
21832
+ else if (match[7] !== void 0) tokens.push({
21835
21833
  text: match[7],
21836
21834
  attrs: { strike: true }
21837
21835
  });
@@ -21858,7 +21856,7 @@ function parseInline(text) {
21858
21856
  lastIndex = match.index + match[0].length;
21859
21857
  }
21860
21858
  if (lastIndex < stripped.length) tokens.push({ text: stripped.slice(lastIndex) });
21861
- return tokens.filter((t) => t.text.length > 0);
21859
+ return tokens.filter((t) => t.node || t.text.length > 0);
21862
21860
  }
21863
21861
  function parseTableRow(line) {
21864
21862
  const parts = line.split("|");
@@ -21986,11 +21984,14 @@ function parseBlocks(markdown) {
21986
21984
  i++;
21987
21985
  continue;
21988
21986
  }
21989
- const docEmbedMatch = line.match(/^!\[\[([^\]|]+?)(?:\|[^\]]*?)?\]\]\s*$/);
21987
+ const docEmbedMatch = line.match(/^!\[\[([^\]|]+?)(?:\|[^\]]*?)?\]\](\{[^}]*\})?\s*$/);
21990
21988
  if (docEmbedMatch) {
21989
+ const props = parseMdcProps(docEmbedMatch[2]);
21990
+ const seamless = "seamless" in props || props["seamless"] === "true" || /\{[^}]*\bseamless\b[^}]*\}/.test(docEmbedMatch[2] ?? "");
21991
21991
  blocks.push({
21992
21992
  type: "docEmbed",
21993
- docId: docEmbedMatch[1]
21993
+ docId: docEmbedMatch[1],
21994
+ seamless: seamless || void 0
21994
21995
  });
21995
21996
  i++;
21996
21997
  continue;
@@ -22268,13 +22269,22 @@ function parseBlocks(markdown) {
22268
22269
  return blocks;
22269
22270
  }
22270
22271
  function fillTextInto(el, tokens) {
22271
- const filtered = tokens.filter((t) => t.text.length > 0);
22272
+ const filtered = tokens.filter((t) => t.node || t.text.length > 0);
22272
22273
  if (!filtered.length) return;
22273
- const xtNodes = filtered.map(() => new yjs.XmlText());
22274
- el.insert(0, xtNodes);
22274
+ const children = filtered.map((tok) => {
22275
+ if (tok.node) {
22276
+ const xe = new yjs.XmlElement(tok.node);
22277
+ if (tok.nodeAttrs) for (const [k, v] of Object.entries(tok.nodeAttrs)) xe.setAttribute(k, v);
22278
+ return xe;
22279
+ }
22280
+ return new yjs.XmlText();
22281
+ });
22282
+ el.insert(0, children);
22275
22283
  filtered.forEach((tok, i) => {
22276
- if (tok.attrs) xtNodes[i].insert(0, tok.text, tok.attrs);
22277
- else xtNodes[i].insert(0, tok.text);
22284
+ if (tok.node) return;
22285
+ const xt = children[i];
22286
+ if (tok.attrs) xt.insert(0, tok.text, tok.attrs);
22287
+ else xt.insert(0, tok.text);
22278
22288
  });
22279
22289
  }
22280
22290
  function blockElName(b) {
@@ -22521,6 +22531,7 @@ function fillBlock(el, block) {
22521
22531
  break;
22522
22532
  case "docEmbed":
22523
22533
  el.setAttribute("docId", block.docId);
22534
+ if (block.seamless) el.setAttribute("seamless", "true");
22524
22535
  break;
22525
22536
  case "svgEmbed":
22526
22537
  el.setAttribute("svg", block.svg);
@@ -22620,7 +22631,14 @@ function elementTextContent(el) {
22620
22631
  for (let i = 0; i < el.length; i++) {
22621
22632
  const child = el.get(i);
22622
22633
  if (child instanceof yjs.XmlText) parts.push(xmlTextToMarkdown(child));
22623
- else if (child instanceof yjs.XmlElement) parts.push(elementTextContent(child));
22634
+ else if (child instanceof yjs.XmlElement) {
22635
+ if (child.nodeName === "docLink") {
22636
+ const docId = child.getAttribute("docId");
22637
+ if (docId) parts.push(`[[${docId}]]`);
22638
+ continue;
22639
+ }
22640
+ parts.push(elementTextContent(child));
22641
+ }
22624
22642
  }
22625
22643
  return parts.join("");
22626
22644
  }
@@ -22649,7 +22667,9 @@ function serializeElement(el, indent = "") {
22649
22667
  case "table": return serializeTable(el);
22650
22668
  case "docEmbed": {
22651
22669
  const docId = el.getAttribute("docId");
22652
- return docId ? `![[${docId}]]` : "";
22670
+ if (!docId) return "";
22671
+ const seamlessAttr = el.getAttribute("seamless");
22672
+ return seamlessAttr === true || seamlessAttr === "true" ? `![[${docId}]]{seamless}` : `![[${docId}]]`;
22653
22673
  }
22654
22674
  case "svgEmbed": {
22655
22675
  const svg = el.getAttribute("svg") || "";