@quartz-community/breadcrumbs 1.0.4 → 1.0.6

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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 4112421: `resolveFrontmatterTitle: false` now works: folder crumbs show the folder's name instead of its index page's frontmatter title. The default (`true`) is unchanged.
8
+
9
+ ## 1.0.5
10
+
11
+ ### Patch Changes
12
+
13
+ - ac440d9: Bundles utils 1.3.1: `slugs.stripDiacritics` now strips accents from Latin letters only and writes ł, ø, ß, æ … in ASCII; other scripts are left as written.
14
+
3
15
  ## 1.0.4
4
16
 
5
17
  ### Patch Changes
@@ -76,8 +76,39 @@ var SLUG_OPTIONS = /* @__PURE__ */ Symbol.for("@quartz-community/utils/slugOptio
76
76
  function getSlugOptions() {
77
77
  return globalThis[SLUG_OPTIONS] ?? {};
78
78
  }
79
+ var LATIN_FOLDS = {
80
+ \u0142: "l",
81
+ \u0141: "L",
82
+ \u00F8: "o",
83
+ \u00D8: "O",
84
+ \u0111: "d",
85
+ \u0110: "D",
86
+ \u00F0: "d",
87
+ \u00D0: "D",
88
+ \u0127: "h",
89
+ \u0126: "H",
90
+ \u0167: "t",
91
+ \u0166: "T",
92
+ \u0140: "l",
93
+ \u013F: "L",
94
+ \u0131: "i",
95
+ \u019A: "l",
96
+ \u0180: "b",
97
+ \u0268: "i",
98
+ \u0289: "u",
99
+ \u00DF: "ss",
100
+ "\u1E9E": "SS",
101
+ \u00E6: "ae",
102
+ \u00C6: "AE",
103
+ \u0153: "oe",
104
+ \u0152: "OE",
105
+ \u00FE: "th",
106
+ \u00DE: "Th"
107
+ };
108
+ var LATIN_FOLD_RE = new RegExp(`[${Object.keys(LATIN_FOLDS).join("")}]`, "gu");
109
+ var LATIN_WITH_MARKS_RE = /(\p{Script=Latin})\p{M}+/gu;
79
110
  function stripDiacritics(s) {
80
- return s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").normalize("NFC");
111
+ return s.normalize("NFD").replace(LATIN_WITH_MARKS_RE, "$1").replace(LATIN_FOLD_RE, (c) => LATIN_FOLDS[c] ?? c).normalize("NFC");
81
112
  }
82
113
  function slugifyPath(s) {
83
114
  const normalized = s.normalize("NFC");
@@ -367,6 +398,36 @@ function stripSlashes2(s, onlyStripPrefix) {
367
398
  }
368
399
  return s;
369
400
  }
401
+ var LATIN_FOLDS2 = {
402
+ \u0142: "l",
403
+ \u0141: "L",
404
+ \u00F8: "o",
405
+ \u00D8: "O",
406
+ \u0111: "d",
407
+ \u0110: "D",
408
+ \u00F0: "d",
409
+ \u00D0: "D",
410
+ \u0127: "h",
411
+ \u0126: "H",
412
+ \u0167: "t",
413
+ \u0166: "T",
414
+ \u0140: "l",
415
+ \u013F: "L",
416
+ \u0131: "i",
417
+ \u019A: "l",
418
+ \u0180: "b",
419
+ \u0268: "i",
420
+ \u0289: "u",
421
+ \u00DF: "ss",
422
+ "\u1E9E": "SS",
423
+ \u00E6: "ae",
424
+ \u00C6: "AE",
425
+ \u0153: "oe",
426
+ \u0152: "OE",
427
+ \u00FE: "th",
428
+ \u00DE: "Th"
429
+ };
430
+ new RegExp(`[${Object.keys(LATIN_FOLDS2).join("")}]`, "gu");
370
431
  var Schema = class {
371
432
  /**
372
433
  * @param {SchemaType['property']} property
@@ -1708,6 +1769,10 @@ var FileTrieNode = class _FileTrieNode {
1708
1769
  const nonIndexTitle = this.data?.title === "index" ? void 0 : this.data?.title;
1709
1770
  return this.displayNameOverride ?? nonIndexTitle ?? this.fileSegmentHint ?? this.slugSegment ?? "";
1710
1771
  }
1772
+ /** The name of the file or folder itself (as written in the content folder), not its title. */
1773
+ get fileName() {
1774
+ return this.fileSegmentHint ?? this.slugSegment ?? "";
1775
+ }
1711
1776
  set displayName(name) {
1712
1777
  this.displayNameOverride = name;
1713
1778
  }
@@ -1847,7 +1912,8 @@ var Breadcrumbs_default = ((opts) => {
1847
1912
  return null;
1848
1913
  }
1849
1914
  const crumbs = pathNodes.map((node, idx) => {
1850
- const crumb = formatCrumb(node.displayName, slug, simplifySlug(node.slug));
1915
+ const name = node.isFolder && !options.resolveFrontmatterTitle ? node.fileName : node.displayName;
1916
+ const crumb = formatCrumb(name, slug, simplifySlug(node.slug));
1851
1917
  if (idx === 0) {
1852
1918
  crumb.displayName = options.rootName;
1853
1919
  }