@tiptap/core 3.20.2 → 3.20.4

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/index.d.cts CHANGED
@@ -788,6 +788,27 @@ interface ExtendableConfig<Options = any, Storage = any, Config extends Extensio
788
788
  * Defines if this markdown element should indent it's child elements
789
789
  */
790
790
  indentsContent?: boolean;
791
+ /**
792
+ * Lets a mark tell the Markdown serializer which inline HTML tags it can
793
+ * safely use when plain markdown delimiters would become ambiguous.
794
+ *
795
+ * This is mainly useful for overlapping marks. For example, bold followed
796
+ * by bold+italic followed by italic cannot always be written back with only
797
+ * `*` and `**` in a way that still parses correctly. In that case, the
798
+ * serializer can close the overlapping section with markdown and reopen the
799
+ * remaining tail with HTML instead.
800
+ *
801
+ * Example:
802
+ * - desired formatting: `**123` + `*456*` + `789 italic`
803
+ * - serialized result: `**123*456***<em>789</em>`
804
+ *
805
+ * If your extension defines custom mark names, set `htmlReopen` on that
806
+ * extension so the serializer can reuse its HTML form for overlap cases.
807
+ */
808
+ htmlReopen?: {
809
+ open: string;
810
+ close: string;
811
+ };
791
812
  };
792
813
  /**
793
814
  * This function extends the schema of the node.
@@ -1789,6 +1810,10 @@ interface MarkdownExtensionSpec {
1789
1810
  parseMarkdown?: (token: MarkdownToken, helpers: MarkdownParseHelpers) => MarkdownParseResult;
1790
1811
  renderMarkdown?: (node: any, helpers: MarkdownRendererHelpers, ctx: RenderContext) => string;
1791
1812
  isIndenting?: boolean;
1813
+ htmlReopen?: {
1814
+ open: string;
1815
+ close: string;
1816
+ };
1792
1817
  /** Custom tokenizer for marked.js to handle non-standard markdown syntax */
1793
1818
  tokenizer?: MarkdownTokenizer;
1794
1819
  }
package/dist/index.d.ts CHANGED
@@ -788,6 +788,27 @@ interface ExtendableConfig<Options = any, Storage = any, Config extends Extensio
788
788
  * Defines if this markdown element should indent it's child elements
789
789
  */
790
790
  indentsContent?: boolean;
791
+ /**
792
+ * Lets a mark tell the Markdown serializer which inline HTML tags it can
793
+ * safely use when plain markdown delimiters would become ambiguous.
794
+ *
795
+ * This is mainly useful for overlapping marks. For example, bold followed
796
+ * by bold+italic followed by italic cannot always be written back with only
797
+ * `*` and `**` in a way that still parses correctly. In that case, the
798
+ * serializer can close the overlapping section with markdown and reopen the
799
+ * remaining tail with HTML instead.
800
+ *
801
+ * Example:
802
+ * - desired formatting: `**123` + `*456*` + `789 italic`
803
+ * - serialized result: `**123*456***<em>789</em>`
804
+ *
805
+ * If your extension defines custom mark names, set `htmlReopen` on that
806
+ * extension so the serializer can reuse its HTML form for overlap cases.
807
+ */
808
+ htmlReopen?: {
809
+ open: string;
810
+ close: string;
811
+ };
791
812
  };
792
813
  /**
793
814
  * This function extends the schema of the node.
@@ -1789,6 +1810,10 @@ interface MarkdownExtensionSpec {
1789
1810
  parseMarkdown?: (token: MarkdownToken, helpers: MarkdownParseHelpers) => MarkdownParseResult;
1790
1811
  renderMarkdown?: (node: any, helpers: MarkdownRendererHelpers, ctx: RenderContext) => string;
1791
1812
  isIndenting?: boolean;
1813
+ htmlReopen?: {
1814
+ open: string;
1815
+ close: string;
1816
+ };
1792
1817
  /** Custom tokenizer for marked.js to handle non-standard markdown syntax */
1793
1818
  tokenizer?: MarkdownTokenizer;
1794
1819
  }
package/dist/index.js CHANGED
@@ -2172,7 +2172,7 @@ function isNodeEmpty(node, {
2172
2172
  return true;
2173
2173
  }
2174
2174
  if (node.isText) {
2175
- return /^\s*$/m.test((_a = node.text) != null ? _a : "");
2175
+ return !/\S/.test((_a = node.text) != null ? _a : "");
2176
2176
  }
2177
2177
  }
2178
2178
  if (node.isText) {