@quartz-community/obsidian-flavored-markdown 0.1.0 → 0.1.2

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - f9cf161: Fix nested callout body text leaking into the title when the body contains bold/italic formatting. Previously, inline nodes (e.g., `**bold**`) following a newline in a nested blockquote callout were incorrectly included in the callout title instead of the callout content.
8
+
3
9
  All notable changes to this project will be documented in this file.
4
10
 
5
11
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
package/dist/index.js CHANGED
@@ -211,9 +211,7 @@ var codes = (
211
211
  lineFeed: -4,
212
212
  carriageReturnLineFeed: -3,
213
213
  horizontalTab: -2,
214
- space: 32,
215
- // `=`
216
- greaterThan: 62}
214
+ space: 32}
217
215
  );
218
216
  var EXCLAMATION = 33;
219
217
  var HASH = 35;
@@ -418,8 +416,7 @@ function tokenize2(effects, ok32, nok) {
418
416
  }
419
417
  function content(code2) {
420
418
  if (code2 === null || isLineEnding2(code2)) return nok(code2);
421
- if (!hasContent && (code2 === EQUALS || code2 === codes.greaterThan))
422
- return nok(code2);
419
+ if (!hasContent && code2 === EQUALS) return nok(code2);
423
420
  if (code2 === EQUALS)
424
421
  return effects.attempt(close, closeAfter, contentConsume)(code2);
425
422
  effects.consume(code2);
@@ -1747,7 +1744,7 @@ var checkbox = (tree) => {
1747
1744
  ...properties,
1748
1745
  checked,
1749
1746
  disabled: false,
1750
- className: "checkbox-toggle"
1747
+ className: ["checkbox-toggle"]
1751
1748
  };
1752
1749
  });
1753
1750
  visit2(tree, "element", (node) => {
@@ -1778,9 +1775,6 @@ var hasClassName = (node, className) => {
1778
1775
  if (Array.isArray(classes)) {
1779
1776
  return classes.includes(className);
1780
1777
  }
1781
- if (typeof classes === "string") {
1782
- return classes.split(/\s+/).includes(className);
1783
- }
1784
1778
  return false;
1785
1779
  };
1786
1780
  var expandButton = () => ({
@@ -12454,7 +12448,7 @@ var youTubeEmbed = (tree) => {
12454
12448
  properties: {
12455
12449
  className: ["external-embed", "youtube"],
12456
12450
  allow: "fullscreen",
12457
- frameBorder: 0,
12451
+ frameBorder: "0",
12458
12452
  width: "600px",
12459
12453
  src: iframeSrc
12460
12454
  },
@@ -12499,6 +12493,18 @@ var BIGINT = 8;
12499
12493
 
12500
12494
  // node_modules/@ungap/structured-clone/esm/deserialize.js
12501
12495
  var env = typeof self === "object" ? self : globalThis;
12496
+ var guard = (name, init) => {
12497
+ switch (name) {
12498
+ case "Function":
12499
+ case "SharedWorker":
12500
+ case "Worker":
12501
+ case "eval":
12502
+ case "setInterval":
12503
+ case "setTimeout":
12504
+ throw new TypeError("unable to deserialize " + name);
12505
+ }
12506
+ return new env[name](init);
12507
+ };
12502
12508
  var deserializer = ($4, _2) => {
12503
12509
  const as = (out, index2) => {
12504
12510
  $4.set(index2, out);
@@ -12544,7 +12550,10 @@ var deserializer = ($4, _2) => {
12544
12550
  }
12545
12551
  case ERROR: {
12546
12552
  const { name, message } = value;
12547
- return as(new env[name](message), index2);
12553
+ return as(
12554
+ typeof env[name] === "function" ? guard(name, message) : new Error(message),
12555
+ index2
12556
+ );
12548
12557
  }
12549
12558
  case BIGINT:
12550
12559
  return as(BigInt(value), index2);
@@ -12557,7 +12566,7 @@ var deserializer = ($4, _2) => {
12557
12566
  return as(new DataView(buffer), value);
12558
12567
  }
12559
12568
  }
12560
- return as(new env[type](value), index2);
12569
+ return as(guard(type, value), index2);
12561
12570
  };
12562
12571
  return unpair;
12563
12572
  };
@@ -12590,8 +12599,8 @@ var typeOf = (value) => {
12590
12599
  }
12591
12600
  if (asString.includes("Array"))
12592
12601
  return [ARRAY, asString];
12593
- if (asString.includes("Error"))
12594
- return [ERROR, asString];
12602
+ if (value instanceof Error)
12603
+ return [ERROR, value.name || "Error"];
12595
12604
  return [OBJECT, asString];
12596
12605
  };
12597
12606
  var shouldSkip = ([TYPE, type]) => TYPE === PRIMITIVE && (type === "function" || type === "symbol");
@@ -12662,7 +12671,7 @@ var serializer = (strict, json, $4, _2) => {
12662
12671
  return index2;
12663
12672
  }
12664
12673
  case DATE:
12665
- return as([TYPE, value.toISOString()], value);
12674
+ return as([TYPE, isNaN(value.getTime()) ? EMPTY : value.toISOString()], value);
12666
12675
  case REGEXP: {
12667
12676
  const { source, flags } = value;
12668
12677
  return as([TYPE, { source, flags }], value);
@@ -12944,6 +12953,7 @@ var html3 = create2({
12944
12953
  allowFullScreen: boolean2,
12945
12954
  allowPaymentRequest: boolean2,
12946
12955
  allowUserMedia: boolean2,
12956
+ alpha: boolean2,
12947
12957
  alt: null,
12948
12958
  as: null,
12949
12959
  async: boolean2,
@@ -12957,8 +12967,12 @@ var html3 = create2({
12957
12967
  checked: boolean2,
12958
12968
  cite: null,
12959
12969
  className: spaceSeparated2,
12970
+ closedBy: null,
12971
+ colorSpace: null,
12960
12972
  cols: number2,
12961
- colSpan: null,
12973
+ colSpan: number2,
12974
+ command: null,
12975
+ commandFor: null,
12962
12976
  content: null,
12963
12977
  contentEditable: booleanish2,
12964
12978
  controls: boolean2,
@@ -13138,8 +13152,10 @@ var html3 = create2({
13138
13152
  seamless: boolean2,
13139
13153
  selected: boolean2,
13140
13154
  shadowRootClonable: boolean2,
13155
+ shadowRootCustomElementRegistry: boolean2,
13141
13156
  shadowRootDelegatesFocus: boolean2,
13142
13157
  shadowRootMode: null,
13158
+ shadowRootSerializable: boolean2,
13143
13159
  shape: null,
13144
13160
  size: number2,
13145
13161
  sizes: null,
@@ -13276,8 +13292,11 @@ var html3 = create2({
13276
13292
  allowTransparency: null,
13277
13293
  autoCorrect: null,
13278
13294
  autoSave: null,
13295
+ credentialless: boolean2,
13279
13296
  disablePictureInPicture: boolean2,
13280
13297
  disableRemotePlayback: boolean2,
13298
+ exportParts: commaSeparated2,
13299
+ part: spaceSeparated2,
13281
13300
  prefix: null,
13282
13301
  property: null,
13283
13302
  results: number2,
@@ -13331,6 +13350,7 @@ var svg3 = create2({
13331
13350
  markerEnd: "marker-end",
13332
13351
  markerMid: "marker-mid",
13333
13352
  markerStart: "marker-start",
13353
+ maskType: "mask-type",
13334
13354
  navDown: "nav-down",
13335
13355
  navDownLeft: "nav-down-left",
13336
13356
  navDownRight: "nav-down-right",
@@ -13601,6 +13621,7 @@ var svg3 = create2({
13601
13621
  markerWidth: null,
13602
13622
  mask: null,
13603
13623
  maskContentUnits: null,
13624
+ maskType: null,
13604
13625
  maskUnits: null,
13605
13626
  mathematical: null,
13606
13627
  max: null,
@@ -25143,9 +25164,9 @@ var ObsidianFlavoredMarkdown = (userOpts) => {
25143
25164
  return;
25144
25165
  }
25145
25166
  const text5 = firstText.value;
25146
- const restOfTitle = firstChild.children.slice(1);
25147
25167
  const [firstLine, ...remainingLines] = text5.split("\n");
25148
25168
  const remainingText = remainingLines.join("\n");
25169
+ const restOfTitle = remainingLines.length > 0 ? [] : firstChild.children.slice(1);
25149
25170
  const match = firstLine.match(calloutRegex);
25150
25171
  if (match && match.input) {
25151
25172
  const [calloutDirective, typeString, calloutMetaData, collapseChar] = match;
@@ -25178,14 +25199,13 @@ var ObsidianFlavoredMarkdown = (userOpts) => {
25178
25199
  </div>`
25179
25200
  };
25180
25201
  const blockquoteContent = [titleHtml];
25181
- if (remainingText.length > 0) {
25182
- blockquoteContent.push({
25202
+ const bodyInlineNodes = remainingLines.length > 0 ? firstChild.children.slice(1) : [];
25203
+ if (remainingText.length > 0 || bodyInlineNodes.length > 0) {
25204
+ calloutContent.unshift({
25183
25205
  type: "paragraph",
25184
25206
  children: [
25185
- {
25186
- type: "text",
25187
- value: remainingText
25188
- }
25207
+ ...remainingText.length > 0 ? [{ type: "text", value: remainingText }] : [],
25208
+ ...bodyInlineNodes
25189
25209
  ]
25190
25210
  });
25191
25211
  }
@@ -25210,7 +25230,7 @@ var ObsidianFlavoredMarkdown = (userOpts) => {
25210
25230
  node.data = {
25211
25231
  hProperties: {
25212
25232
  ...node.data?.hProperties ?? {},
25213
- className: classNames.join(" "),
25233
+ className: classNames,
25214
25234
  "data-callout": calloutType,
25215
25235
  "data-callout-fold": collapse,
25216
25236
  "data-callout-metadata": calloutMetaData