@quartz-community/remark-obsidian 2.2.0 → 2.2.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.
package/dist/legacy.js CHANGED
@@ -2505,6 +2505,35 @@ function spelledTarget(path, heading, resolved) {
2505
2505
  if (heading !== resolved.heading) spelled.spelledHeading = heading;
2506
2506
  return Object.keys(spelled).length > 0 ? spelled : void 0;
2507
2507
  }
2508
+ function dropClosingBackslash(part) {
2509
+ return part.slice(0, -1).trimEnd();
2510
+ }
2511
+
2512
+ // src/lib/tag-char.ts
2513
+ var TAG_STOP = /[\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~[\]\\\s]/u;
2514
+ function isTagCharacter(char) {
2515
+ return char !== "" && !TAG_STOP.test(char);
2516
+ }
2517
+
2518
+ // src/lib/colour-marker.ts
2519
+ var COLOUR_MARKERS = /* @__PURE__ */ new Set([
2520
+ 128308,
2521
+ 128997,
2522
+ 128992,
2523
+ 128999,
2524
+ 128993,
2525
+ 129e3,
2526
+ 128994,
2527
+ 129001,
2528
+ 128309,
2529
+ 128998,
2530
+ 128995,
2531
+ 129002
2532
+ ]);
2533
+ function colourMarkerLength(content) {
2534
+ const first = content.codePointAt(0);
2535
+ return first !== void 0 && COLOUR_MARKERS.has(first) ? 2 : 0;
2536
+ }
2508
2537
 
2509
2538
  // src/lib/syntax/highlight.ts
2510
2539
  var MARKER2 = "=";
@@ -7409,12 +7438,6 @@ function keys(value) {
7409
7438
  return result;
7410
7439
  }
7411
7440
 
7412
- // src/lib/tag-char.ts
7413
- var TAG_STOP = /[\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~[\]\\\s]/u;
7414
- function isTagCharacter(char) {
7415
- return char !== "" && !TAG_STOP.test(char);
7416
- }
7417
-
7418
7441
  // src/rp8/reader.ts
7419
7442
  function along(point, columns) {
7420
7443
  return {
@@ -7551,9 +7574,27 @@ function tablePipeStyles(tables) {
7551
7574
  tables.blockTokenizers.table = function(eat, value, silent) {
7552
7575
  const end = tableEnd(value);
7553
7576
  if (end === -1) return void 0;
7554
- return stockTable.call(this, eat, value.slice(0, end), silent);
7577
+ const table2 = stockTable.call(this, eat, value.slice(0, end), silent);
7578
+ if (table2 && typeof table2 === "object" && !startsWithPipe(value)) {
7579
+ leadingIndentCells(table2, value.slice(0, end));
7580
+ }
7581
+ return table2;
7555
7582
  };
7556
7583
  }
7584
+ function leadingIndentCells(table2, source) {
7585
+ const lines = source.split("\n");
7586
+ lines.splice(1, 1);
7587
+ for (const [index, row] of (table2.children ?? []).entries()) {
7588
+ const pipe = /^[ \t]+\|/u.exec(lines[index] ?? "");
7589
+ if (!pipe) continue;
7590
+ const at2 = along(row.position.start, pipe[0].length - 1);
7591
+ row.children?.unshift({
7592
+ type: "tableCell",
7593
+ children: [],
7594
+ position: { start: at2, end: { ...at2 } }
7595
+ });
7596
+ }
7597
+ }
7557
7598
  var Wikilink = /^!?\[\[(?:(?!\[\[)[^\n\r\u2028\u2029])+?\]\]/;
7558
7599
  function wikilinks(tables) {
7559
7600
  const wikilink2 = function(eat, value, silent) {
@@ -7616,10 +7657,12 @@ function highlights(tables) {
7616
7657
  if (body === null) return void 0;
7617
7658
  if (silent === true) return true;
7618
7659
  const now = eat.now();
7619
- return eat(`==${body}==`)({
7620
- type: "highlight",
7621
- children: this.tokenizeInline(body, along(now, 2))
7622
- });
7660
+ const marker = colourMarkerLength(body);
7661
+ const children = marker > 0 && body.charAt(marker) === "#" ? [
7662
+ ...this.tokenizeInline(body.slice(0, marker), along(now, 2)),
7663
+ ...this.tokenizeInline(body.slice(marker), along(now, 2 + marker))
7664
+ ] : this.tokenizeInline(body, along(now, 2));
7665
+ return eat(`==${body}==`)({ type: "highlight", children });
7623
7666
  };
7624
7667
  highlight.locator = (value, fromIndex) => value.indexOf("==", fromIndex);
7625
7668
  tables.inlineTokenizers.highlight = highlight;
@@ -8145,12 +8188,20 @@ function wikilink(raw) {
8145
8188
  const writtenHeading = node.heading;
8146
8189
  node.path = resolveTarget(node.path);
8147
8190
  node.heading = resolveTarget(node.heading);
8148
- const spelled = spelledTarget(written, writtenHeading, node);
8191
+ let spelled = spelledTarget(written, writtenHeading, node);
8149
8192
  const resolved = parts.heading ? "heading" : parts.path ? "path" : void 0;
8150
8193
  let stripped;
8151
8194
  if (resolved && node[resolved].endsWith("\\")) {
8152
- node[resolved] = node[resolved].slice(0, -1);
8195
+ const kept = node[resolved].slice(0, -1);
8196
+ node[resolved] = dropClosingBackslash(node[resolved]);
8153
8197
  stripped = resolved;
8198
+ if (kept !== node[resolved] && !parts.alias) {
8199
+ const key = resolved === "path" ? "spelledPath" : "spelledHeading";
8200
+ spelled = {
8201
+ ...spelled,
8202
+ [key]: resolved === "path" ? written : writtenHeading
8203
+ };
8204
+ }
8154
8205
  }
8155
8206
  const value = embedded ? node.path : parts.alias ? node.alias : [written, ...writtenHeading.split("#")].filter(Boolean).join(" > ");
8156
8207
  return {