@seed-hypermedia/client 0.0.22 → 0.0.24

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 (2) hide show
  1. package/dist/index.mjs +30 -7
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -2261,6 +2261,34 @@ function parseInlineFormatting(raw) {
2261
2261
  }
2262
2262
  }
2263
2263
  }
2264
+ if (raw[i] === "<") {
2265
+ const end = raw.indexOf(">", i + 1);
2266
+ if (end !== -1) {
2267
+ const inner = raw.slice(i + 1, end);
2268
+ if (/^[a-zA-Z][a-zA-Z0-9+.-]*:\S*$/.test(inner) && !/[\s<>]/.test(inner)) {
2269
+ const start = text.length;
2270
+ if (inner.startsWith("hm://")) {
2271
+ text += "\uFFFC";
2272
+ annotations.push({
2273
+ type: "Embed",
2274
+ starts: [start],
2275
+ ends: [text.length],
2276
+ link: inner
2277
+ });
2278
+ } else {
2279
+ text += inner;
2280
+ annotations.push({
2281
+ type: "Link",
2282
+ starts: [start],
2283
+ ends: [text.length],
2284
+ link: inner
2285
+ });
2286
+ }
2287
+ i = end + 1;
2288
+ continue;
2289
+ }
2290
+ }
2291
+ }
2264
2292
  if (raw[i] === "[") {
2265
2293
  const closeBracket = findClosingBracket(raw, i);
2266
2294
  if (closeBracket !== -1 && closeBracket + 1 < raw.length && raw[closeBracket + 1] === "(") {
@@ -2830,7 +2858,7 @@ function blockNodeToMarkdown(node, depth, opts) {
2830
2858
  } else if (childrenType === "Blockquote") {
2831
2859
  result += "\n" + indent(depth + 1) + "> " + childMd.trim();
2832
2860
  } else {
2833
- result += "\n" + childMd;
2861
+ result += "\n\n" + childMd;
2834
2862
  }
2835
2863
  }
2836
2864
  }
@@ -2950,12 +2978,7 @@ function getAnnotationMarker(ann, type) {
2950
2978
  }
2951
2979
  case "Embed": {
2952
2980
  const link = "link" in ann ? ann.link || "" : "";
2953
- if (type === "open") {
2954
- const pathPart = link.includes("/") ? link.split("/").pop() || "embed" : link.replace("hm://", "").slice(0, 12);
2955
- return `[\u2197 ${pathPart}`;
2956
- } else {
2957
- return `](${link})`;
2958
- }
2981
+ return type === "open" ? `<${link}` : ">";
2959
2982
  }
2960
2983
  default:
2961
2984
  return "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-hypermedia/client",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/seed-hypermedia/seed",