@doist/typist 10.0.0-next.1 → 10.0.0-next.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.
Files changed (236) hide show
  1. package/dist/components/typist-editor.d.ts +126 -123
  2. package/dist/components/typist-editor.d.ts.map +1 -1
  3. package/dist/components/typist-editor.helper.d.ts +8 -11
  4. package/dist/components/typist-editor.helper.d.ts.map +1 -1
  5. package/dist/components/typist-editor.helper.js +21 -19
  6. package/dist/components/typist-editor.helper.js.map +1 -0
  7. package/dist/components/typist-editor.js +133 -135
  8. package/dist/components/typist-editor.js.map +1 -0
  9. package/dist/constants/common.js +9 -5
  10. package/dist/constants/common.js.map +1 -0
  11. package/dist/constants/extension-priorities.d.ts +3 -1
  12. package/dist/constants/extension-priorities.d.ts.map +1 -1
  13. package/dist/constants/extension-priorities.js +34 -30
  14. package/dist/constants/extension-priorities.js.map +1 -0
  15. package/dist/constants/regular-expressions.js +14 -10
  16. package/dist/constants/regular-expressions.js.map +1 -0
  17. package/dist/extensions/core/extra-editor-commands/commands/create-paragraph-end.d.ts +12 -9
  18. package/dist/extensions/core/extra-editor-commands/commands/create-paragraph-end.d.ts.map +1 -1
  19. package/dist/extensions/core/extra-editor-commands/commands/create-paragraph-end.js +16 -19
  20. package/dist/extensions/core/extra-editor-commands/commands/create-paragraph-end.js.map +1 -0
  21. package/dist/extensions/core/extra-editor-commands/commands/extend-word-range.d.ts +12 -9
  22. package/dist/extensions/core/extra-editor-commands/commands/extend-word-range.d.ts.map +1 -1
  23. package/dist/extensions/core/extra-editor-commands/commands/extend-word-range.js +25 -28
  24. package/dist/extensions/core/extra-editor-commands/commands/extend-word-range.js.map +1 -0
  25. package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content-at.d.ts +24 -22
  26. package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content-at.d.ts.map +1 -1
  27. package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content-at.js +34 -36
  28. package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content-at.js.map +1 -0
  29. package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content.d.ts +23 -20
  30. package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content.d.ts.map +1 -1
  31. package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content.js +15 -8
  32. package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content.js.map +1 -0
  33. package/dist/extensions/core/extra-editor-commands/extra-editor-commands.js +22 -18
  34. package/dist/extensions/core/extra-editor-commands/extra-editor-commands.js.map +1 -0
  35. package/dist/extensions/core/view-event-handlers.d.ts +14 -13
  36. package/dist/extensions/core/view-event-handlers.d.ts.map +1 -1
  37. package/dist/extensions/core/view-event-handlers.js +33 -31
  38. package/dist/extensions/core/view-event-handlers.js.map +1 -0
  39. package/dist/extensions/plain-text/paste-multiline-text.js +45 -59
  40. package/dist/extensions/plain-text/paste-multiline-text.js.map +1 -0
  41. package/dist/extensions/plain-text/plain-text-document.d.ts +7 -7
  42. package/dist/extensions/plain-text/plain-text-document.d.ts.map +1 -1
  43. package/dist/extensions/plain-text/plain-text-document.js +14 -13
  44. package/dist/extensions/plain-text/plain-text-document.js.map +1 -0
  45. package/dist/extensions/plain-text/plain-text-kit.d.ts +35 -33
  46. package/dist/extensions/plain-text/plain-text-kit.d.ts.map +1 -1
  47. package/dist/extensions/plain-text/plain-text-kit.js +33 -48
  48. package/dist/extensions/plain-text/plain-text-kit.js.map +1 -0
  49. package/dist/extensions/plain-text/plain-text-paragraph.d.ts +2 -9
  50. package/dist/extensions/plain-text/plain-text-paragraph.js +11 -11
  51. package/dist/extensions/plain-text/plain-text-paragraph.js.map +1 -0
  52. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-lists.js +37 -81
  53. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-lists.js.map +1 -0
  54. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-select-wrap.js +32 -42
  55. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-select-wrap.js.map +1 -0
  56. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-url-pasting.js +24 -37
  57. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-url-pasting.js.map +1 -0
  58. package/dist/extensions/plain-text/smart-markdown-typing/smart-markdown-typing.js +21 -13
  59. package/dist/extensions/plain-text/smart-markdown-typing/smart-markdown-typing.js.map +1 -0
  60. package/dist/extensions/rich-text/bold-and-italics.js +42 -40
  61. package/dist/extensions/rich-text/bold-and-italics.js.map +1 -0
  62. package/dist/extensions/rich-text/curvenote-codemark.js +16 -14
  63. package/dist/extensions/rich-text/curvenote-codemark.js.map +1 -0
  64. package/dist/extensions/rich-text/paste-emojis.js +20 -22
  65. package/dist/extensions/rich-text/paste-emojis.js.map +1 -0
  66. package/dist/extensions/rich-text/paste-markdown.js +46 -86
  67. package/dist/extensions/rich-text/paste-markdown.js.map +1 -0
  68. package/dist/extensions/rich-text/rich-text-bullet-list.d.ts +10 -9
  69. package/dist/extensions/rich-text/rich-text-bullet-list.d.ts.map +1 -1
  70. package/dist/extensions/rich-text/rich-text-bullet-list.js +42 -56
  71. package/dist/extensions/rich-text/rich-text-bullet-list.js.map +1 -0
  72. package/dist/extensions/rich-text/rich-text-code.js +34 -34
  73. package/dist/extensions/rich-text/rich-text-code.js.map +1 -0
  74. package/dist/extensions/rich-text/rich-text-document.d.ts +7 -7
  75. package/dist/extensions/rich-text/rich-text-document.d.ts.map +1 -1
  76. package/dist/extensions/rich-text/rich-text-document.js +14 -13
  77. package/dist/extensions/rich-text/rich-text-document.js.map +1 -0
  78. package/dist/extensions/rich-text/rich-text-heading.d.ts +5 -4
  79. package/dist/extensions/rich-text/rich-text-heading.d.ts.map +1 -1
  80. package/dist/extensions/rich-text/rich-text-heading.js +25 -25
  81. package/dist/extensions/rich-text/rich-text-heading.js.map +1 -0
  82. package/dist/extensions/rich-text/rich-text-image.d.ts +53 -52
  83. package/dist/extensions/rich-text/rich-text-image.d.ts.map +1 -1
  84. package/dist/extensions/rich-text/rich-text-image.js +88 -105
  85. package/dist/extensions/rich-text/rich-text-image.js.map +1 -0
  86. package/dist/extensions/rich-text/rich-text-kit.d.ts +127 -125
  87. package/dist/extensions/rich-text/rich-text-kit.d.ts.map +1 -1
  88. package/dist/extensions/rich-text/rich-text-kit.js +73 -135
  89. package/dist/extensions/rich-text/rich-text-kit.js.map +1 -0
  90. package/dist/extensions/rich-text/rich-text-link.d.ts +5 -4
  91. package/dist/extensions/rich-text/rich-text-link.d.ts.map +1 -1
  92. package/dist/extensions/rich-text/rich-text-link.js +82 -90
  93. package/dist/extensions/rich-text/rich-text-link.js.map +1 -0
  94. package/dist/extensions/rich-text/rich-text-ordered-list.d.ts +10 -9
  95. package/dist/extensions/rich-text/rich-text-ordered-list.d.ts.map +1 -1
  96. package/dist/extensions/rich-text/rich-text-ordered-list.js +42 -56
  97. package/dist/extensions/rich-text/rich-text-ordered-list.js.map +1 -0
  98. package/dist/extensions/rich-text/rich-text-strikethrough.d.ts +5 -4
  99. package/dist/extensions/rich-text/rich-text-strikethrough.d.ts.map +1 -1
  100. package/dist/extensions/rich-text/rich-text-strikethrough.js +10 -10
  101. package/dist/extensions/rich-text/rich-text-strikethrough.js.map +1 -0
  102. package/dist/extensions/shared/copy-markdown-source.js +22 -31
  103. package/dist/extensions/shared/copy-markdown-source.js.map +1 -0
  104. package/dist/extensions/shared/paste-html-table-as-string.js +47 -60
  105. package/dist/extensions/shared/paste-html-table-as-string.js.map +1 -0
  106. package/dist/extensions/shared/paste-singleline-text.js +31 -39
  107. package/dist/extensions/shared/paste-singleline-text.js.map +1 -0
  108. package/dist/factories/create-suggestion-extension.d.ts +74 -74
  109. package/dist/factories/create-suggestion-extension.d.ts.map +1 -1
  110. package/dist/factories/create-suggestion-extension.js +139 -161
  111. package/dist/factories/create-suggestion-extension.js.map +1 -0
  112. package/dist/helpers/dom.js +9 -5
  113. package/dist/helpers/dom.js.map +1 -0
  114. package/dist/helpers/schema.d.ts +5 -3
  115. package/dist/helpers/schema.d.ts.map +1 -1
  116. package/dist/helpers/schema.js +25 -21
  117. package/dist/helpers/schema.js.map +1 -0
  118. package/dist/helpers/serializer.js +24 -28
  119. package/dist/helpers/serializer.js.map +1 -0
  120. package/dist/helpers/unified.js +24 -17
  121. package/dist/helpers/unified.js.map +1 -0
  122. package/dist/hooks/use-editor.js +50 -53
  123. package/dist/hooks/use-editor.js.map +1 -0
  124. package/dist/index.d.ts +25 -31
  125. package/dist/index.js +24 -24
  126. package/dist/serializers/html/html.d.ts +12 -10
  127. package/dist/serializers/html/html.d.ts.map +1 -1
  128. package/dist/serializers/html/html.js +67 -127
  129. package/dist/serializers/html/html.js.map +1 -0
  130. package/dist/serializers/html/plugins/rehype-code-block.js +17 -17
  131. package/dist/serializers/html/plugins/rehype-code-block.js.map +1 -0
  132. package/dist/serializers/html/plugins/rehype-image.js +20 -30
  133. package/dist/serializers/html/plugins/rehype-image.js.map +1 -0
  134. package/dist/serializers/html/plugins/rehype-suggestions.js +31 -32
  135. package/dist/serializers/html/plugins/rehype-suggestions.js.map +1 -0
  136. package/dist/serializers/html/plugins/rehype-task-list.js +31 -32
  137. package/dist/serializers/html/plugins/rehype-task-list.js.map +1 -0
  138. package/dist/serializers/html/plugins/remark-autolink-literal.d.ts +4 -1
  139. package/dist/serializers/html/plugins/remark-autolink-literal.d.ts.map +1 -1
  140. package/dist/serializers/html/plugins/remark-autolink-literal.js +25 -21
  141. package/dist/serializers/html/plugins/remark-autolink-literal.js.map +1 -0
  142. package/dist/serializers/html/plugins/remark-disable-constructs.js +21 -41
  143. package/dist/serializers/html/plugins/remark-disable-constructs.js.map +1 -0
  144. package/dist/serializers/html/plugins/remark-strikethrough.d.ts +5 -2
  145. package/dist/serializers/html/plugins/remark-strikethrough.d.ts.map +1 -1
  146. package/dist/serializers/html/plugins/remark-strikethrough.js +25 -21
  147. package/dist/serializers/html/plugins/remark-strikethrough.js.map +1 -0
  148. package/dist/serializers/markdown/markdown.d.ts +13 -12
  149. package/dist/serializers/markdown/markdown.d.ts.map +1 -1
  150. package/dist/serializers/markdown/markdown.js +78 -154
  151. package/dist/serializers/markdown/markdown.js.map +1 -0
  152. package/dist/serializers/markdown/plugins/image.js +27 -24
  153. package/dist/serializers/markdown/plugins/image.js.map +1 -0
  154. package/dist/serializers/markdown/plugins/list-item.js +32 -37
  155. package/dist/serializers/markdown/plugins/list-item.js.map +1 -0
  156. package/dist/serializers/markdown/plugins/paragraph.js +19 -19
  157. package/dist/serializers/markdown/plugins/paragraph.js.map +1 -0
  158. package/dist/serializers/markdown/plugins/strikethrough.js +23 -19
  159. package/dist/serializers/markdown/plugins/strikethrough.js.map +1 -0
  160. package/dist/serializers/markdown/plugins/suggestion.js +21 -19
  161. package/dist/serializers/markdown/plugins/suggestion.js.map +1 -0
  162. package/dist/serializers/markdown/plugins/task-item.js +31 -35
  163. package/dist/serializers/markdown/plugins/task-item.js.map +1 -0
  164. package/dist/utilities/can-insert-node-at.d.ts +12 -5
  165. package/dist/utilities/can-insert-node-at.d.ts.map +1 -1
  166. package/dist/utilities/can-insert-node-at.js +10 -8
  167. package/dist/utilities/can-insert-node-at.js.map +1 -0
  168. package/dist/utilities/can-insert-suggestion.d.ts +11 -5
  169. package/dist/utilities/can-insert-suggestion.d.ts.map +1 -1
  170. package/dist/utilities/can-insert-suggestion.js +15 -12
  171. package/dist/utilities/can-insert-suggestion.js.map +1 -0
  172. package/package.json +4 -3
  173. package/dist/constants/common.d.ts +0 -10
  174. package/dist/constants/common.d.ts.map +0 -1
  175. package/dist/constants/regular-expressions.d.ts +0 -18
  176. package/dist/constants/regular-expressions.d.ts.map +0 -1
  177. package/dist/extensions/core/extra-editor-commands/extra-editor-commands.d.ts +0 -9
  178. package/dist/extensions/core/extra-editor-commands/extra-editor-commands.d.ts.map +0 -1
  179. package/dist/extensions/plain-text/paste-multiline-text.d.ts +0 -10
  180. package/dist/extensions/plain-text/paste-multiline-text.d.ts.map +0 -1
  181. package/dist/extensions/plain-text/plain-text-paragraph.d.ts.map +0 -1
  182. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-lists.d.ts +0 -9
  183. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-lists.d.ts.map +0 -1
  184. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-select-wrap.d.ts +0 -9
  185. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-select-wrap.d.ts.map +0 -1
  186. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-url-pasting.d.ts +0 -9
  187. package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-url-pasting.d.ts.map +0 -1
  188. package/dist/extensions/plain-text/smart-markdown-typing/smart-markdown-typing.d.ts +0 -8
  189. package/dist/extensions/plain-text/smart-markdown-typing/smart-markdown-typing.d.ts.map +0 -1
  190. package/dist/extensions/rich-text/bold-and-italics.d.ts +0 -8
  191. package/dist/extensions/rich-text/bold-and-italics.d.ts.map +0 -1
  192. package/dist/extensions/rich-text/curvenote-codemark.d.ts +0 -11
  193. package/dist/extensions/rich-text/curvenote-codemark.d.ts.map +0 -1
  194. package/dist/extensions/rich-text/paste-emojis.d.ts +0 -9
  195. package/dist/extensions/rich-text/paste-emojis.d.ts.map +0 -1
  196. package/dist/extensions/rich-text/paste-markdown.d.ts +0 -11
  197. package/dist/extensions/rich-text/paste-markdown.d.ts.map +0 -1
  198. package/dist/extensions/rich-text/rich-text-code.d.ts +0 -17
  199. package/dist/extensions/rich-text/rich-text-code.d.ts.map +0 -1
  200. package/dist/extensions/shared/copy-markdown-source.d.ts +0 -20
  201. package/dist/extensions/shared/copy-markdown-source.d.ts.map +0 -1
  202. package/dist/extensions/shared/paste-html-table-as-string.d.ts +0 -20
  203. package/dist/extensions/shared/paste-html-table-as-string.d.ts.map +0 -1
  204. package/dist/extensions/shared/paste-singleline-text.d.ts +0 -10
  205. package/dist/extensions/shared/paste-singleline-text.d.ts.map +0 -1
  206. package/dist/helpers/dom.d.ts +0 -8
  207. package/dist/helpers/dom.d.ts.map +0 -1
  208. package/dist/helpers/serializer.d.ts +0 -21
  209. package/dist/helpers/serializer.d.ts.map +0 -1
  210. package/dist/helpers/unified.d.ts +0 -21
  211. package/dist/helpers/unified.d.ts.map +0 -1
  212. package/dist/hooks/use-editor.d.ts +0 -19
  213. package/dist/hooks/use-editor.d.ts.map +0 -1
  214. package/dist/index.d.ts.map +0 -1
  215. package/dist/serializers/html/plugins/rehype-code-block.d.ts +0 -10
  216. package/dist/serializers/html/plugins/rehype-code-block.d.ts.map +0 -1
  217. package/dist/serializers/html/plugins/rehype-image.d.ts +0 -11
  218. package/dist/serializers/html/plugins/rehype-image.d.ts.map +0 -1
  219. package/dist/serializers/html/plugins/rehype-suggestions.d.ts +0 -10
  220. package/dist/serializers/html/plugins/rehype-suggestions.d.ts.map +0 -1
  221. package/dist/serializers/html/plugins/rehype-task-list.d.ts +0 -7
  222. package/dist/serializers/html/plugins/rehype-task-list.d.ts.map +0 -1
  223. package/dist/serializers/html/plugins/remark-disable-constructs.d.ts +0 -11
  224. package/dist/serializers/html/plugins/remark-disable-constructs.d.ts.map +0 -1
  225. package/dist/serializers/markdown/plugins/image.d.ts +0 -12
  226. package/dist/serializers/markdown/plugins/image.d.ts.map +0 -1
  227. package/dist/serializers/markdown/plugins/list-item.d.ts +0 -14
  228. package/dist/serializers/markdown/plugins/list-item.d.ts.map +0 -1
  229. package/dist/serializers/markdown/plugins/paragraph.d.ts +0 -13
  230. package/dist/serializers/markdown/plugins/paragraph.d.ts.map +0 -1
  231. package/dist/serializers/markdown/plugins/strikethrough.d.ts +0 -13
  232. package/dist/serializers/markdown/plugins/strikethrough.d.ts.map +0 -1
  233. package/dist/serializers/markdown/plugins/suggestion.d.ts +0 -11
  234. package/dist/serializers/markdown/plugins/suggestion.d.ts.map +0 -1
  235. package/dist/serializers/markdown/plugins/task-item.d.ts +0 -14
  236. package/dist/serializers/markdown/plugins/task-item.d.ts.map +0 -1
@@ -1,34 +1,24 @@
1
- import { remove } from 'unist-util-remove';
2
- import { visit } from 'unist-util-visit';
3
- import { isHastElementNode } from '../../../helpers/unified';
1
+ import { isHastElementNode } from "../../../helpers/unified.js";
2
+ import { visit } from "unist-util-visit";
3
+ import { remove } from "unist-util-remove";
4
+ //#region src/serializers/html/plugins/rehype-image.ts
4
5
  /**
5
- * A rehype plugin to remove the wrapping paragraph from images and to remove all inline images if
6
- * the editor was configured without inline image support (Tiptap default).
7
- *
8
- * @param schema The editor schema to be used for nodes and marks detection.
9
- */
6
+ * A rehype plugin to remove the wrapping paragraph from images and to remove all inline images if
7
+ * the editor was configured without inline image support (Tiptap default).
8
+ *
9
+ * @param schema The editor schema to be used for nodes and marks detection.
10
+ */
10
11
  function rehypeImage(schema) {
11
- const allowInlineImages = schema.nodes.image ? schema.nodes.image.spec.inline : false;
12
- // Return the tree as-is if the editor does not support inline images
13
- if (allowInlineImages) {
14
- return (tree) => tree;
15
- }
16
- return (...[tree]) => {
17
- visit(tree, 'element', (node, index, parent) => {
18
- if (isHastElementNode(node, 'p')) {
19
- const areAllChildrenImages = node.children.every((c) => isHastElementNode(c, 'img'));
20
- // Replace the paragraph with the image children if all children are images, or
21
- // remove all images from the paragraph if it contains non-image children since the
22
- // editor does not support inline images
23
- if (areAllChildrenImages) {
24
- parent.children.splice(index, 1, ...node.children);
25
- }
26
- else {
27
- remove(node, (n) => isHastElementNode(n, 'img'));
28
- }
29
- }
30
- });
31
- return tree;
32
- };
12
+ if (schema.nodes.image ? schema.nodes.image.spec.inline : false) return (tree) => tree;
13
+ return (...[tree]) => {
14
+ visit(tree, "element", (node, index, parent) => {
15
+ if (isHastElementNode(node, "p")) if (node.children.every((c) => isHastElementNode(c, "img"))) parent.children.splice(index, 1, ...node.children);
16
+ else remove(node, (n) => isHastElementNode(n, "img"));
17
+ });
18
+ return tree;
19
+ };
33
20
  }
21
+ //#endregion
34
22
  export { rehypeImage };
23
+
24
+ //# sourceMappingURL=rehype-image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rehype-image.js","names":[],"sources":["../../../../src/serializers/html/plugins/rehype-image.ts"],"sourcesContent":["import { remove } from 'unist-util-remove'\nimport { visit } from 'unist-util-visit'\n\nimport { isHastElementNode } from '../../../helpers/unified'\n\nimport type { Schema } from '@tiptap/pm/model'\nimport type { Node as HastNode, Parent as HastParent } from 'hast'\nimport type { Transformer } from 'unified'\n\n/**\n * A rehype plugin to remove the wrapping paragraph from images and to remove all inline images if\n * the editor was configured without inline image support (Tiptap default).\n *\n * @param schema The editor schema to be used for nodes and marks detection.\n */\nfunction rehypeImage(schema: Schema): Transformer {\n const allowInlineImages = schema.nodes.image ? schema.nodes.image.spec.inline : false\n\n // Return the tree as-is if the editor does not support inline images\n if (allowInlineImages) {\n return (tree) => tree\n }\n\n return (...[tree]: Parameters<Transformer>): ReturnType<Transformer> => {\n visit(tree, 'element', (node: HastNode, index: number, parent: HastParent) => {\n if (isHastElementNode(node, 'p')) {\n const areAllChildrenImages = node.children.every((c) => isHastElementNode(c, 'img'))\n\n // Replace the paragraph with the image children if all children are images, or\n // remove all images from the paragraph if it contains non-image children since the\n // editor does not support inline images\n if (areAllChildrenImages) {\n parent.children.splice(index, 1, ...node.children)\n } else {\n remove(node, (n) => isHastElementNode(n, 'img'))\n }\n }\n })\n\n return tree\n }\n}\n\nexport { rehypeImage }\n"],"mappings":";;;;;;;;;;AAeA,SAAS,YAAY,QAA6B;AAI9C,KAH0B,OAAO,MAAM,QAAQ,OAAO,MAAM,MAAM,KAAK,SAAS,MAI5E,SAAQ,SAAS;AAGrB,SAAQ,GAAG,CAAC,UAA4D;AACpE,QAAM,MAAM,YAAY,MAAgB,OAAe,WAAuB;AAC1E,OAAI,kBAAkB,MAAM,IAAI,CAM5B,KAL6B,KAAK,SAAS,OAAO,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAMhF,QAAO,SAAS,OAAO,OAAO,GAAG,GAAG,KAAK,SAAS;OAElD,QAAO,OAAO,MAAM,kBAAkB,GAAG,MAAM,CAAC;IAG1D;AAEF,SAAO"}
@@ -1,36 +1,35 @@
1
- import { visit } from 'unist-util-visit';
2
- import { buildSuggestionSchemaPartialRegex } from '../../../helpers/serializer';
3
- import { isHastElementNode, isHastTextNode } from '../../../helpers/unified';
1
+ import { isHastElementNode, isHastTextNode } from "../../../helpers/unified.js";
2
+ import { buildSuggestionSchemaPartialRegex } from "../../../helpers/serializer.js";
3
+ import { visit } from "unist-util-visit";
4
+ //#region src/serializers/html/plugins/rehype-suggestions.ts
4
5
  /**
5
- * A rehype plugin to add support for suggestions nodes (e.g., `@username` or `#channel).
6
- *
7
- * @param schema The editor schema to be used for suggestion nodes detection.
8
- */
6
+ * A rehype plugin to add support for suggestions nodes (e.g., `@username` or `#channel).
7
+ *
8
+ * @param schema The editor schema to be used for suggestion nodes detection.
9
+ */
9
10
  function rehypeSuggestions(schema) {
10
- const suggestionSchemaPartialRegex = buildSuggestionSchemaPartialRegex(schema);
11
- // Return the tree as-is if the editor does not support suggestions
12
- if (!suggestionSchemaPartialRegex) {
13
- return (tree) => tree;
14
- }
15
- return (...[tree]) => {
16
- const suggestionSchemaRegex = new RegExp(`^${suggestionSchemaPartialRegex}`);
17
- visit(tree, 'element', (node) => {
18
- if (isHastElementNode(node, 'a') &&
19
- suggestionSchemaRegex.test(String(node.properties?.href))) {
20
- const [, schema, id] = /^([a-z-]+):\/\/(\S+)$/i.exec(String(node.properties?.href)) || [];
21
- // Replace the link element with a span containing the suggestion attributes
22
- if (schema && id && isHastTextNode(node.children[0])) {
23
- node.tagName = 'span';
24
- node.properties = {
25
- [`data-${schema}`]: '',
26
- 'data-id': id,
27
- 'data-label': node.children[0].value,
28
- };
29
- node.children = [];
30
- }
31
- }
32
- });
33
- return tree;
34
- };
11
+ const suggestionSchemaPartialRegex = buildSuggestionSchemaPartialRegex(schema);
12
+ if (!suggestionSchemaPartialRegex) return (tree) => tree;
13
+ return (...[tree]) => {
14
+ const suggestionSchemaRegex = new RegExp(`^${suggestionSchemaPartialRegex}`);
15
+ visit(tree, "element", (node) => {
16
+ if (isHastElementNode(node, "a") && suggestionSchemaRegex.test(String(node.properties?.href))) {
17
+ const [, schema, id] = /^([a-z-]+):\/\/(\S+)$/i.exec(String(node.properties?.href)) || [];
18
+ if (schema && id && isHastTextNode(node.children[0])) {
19
+ node.tagName = "span";
20
+ node.properties = {
21
+ [`data-${schema}`]: "",
22
+ "data-id": id,
23
+ "data-label": node.children[0].value
24
+ };
25
+ node.children = [];
26
+ }
27
+ }
28
+ });
29
+ return tree;
30
+ };
35
31
  }
32
+ //#endregion
36
33
  export { rehypeSuggestions };
34
+
35
+ //# sourceMappingURL=rehype-suggestions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rehype-suggestions.js","names":[],"sources":["../../../../src/serializers/html/plugins/rehype-suggestions.ts"],"sourcesContent":["import { visit } from 'unist-util-visit'\n\nimport { buildSuggestionSchemaPartialRegex } from '../../../helpers/serializer'\nimport { isHastElementNode, isHastTextNode } from '../../../helpers/unified'\n\nimport type { Schema } from '@tiptap/pm/model'\nimport type { Node as HastNode } from 'hast'\nimport type { Transformer } from 'unified'\n\n/**\n * A rehype plugin to add support for suggestions nodes (e.g., `@username` or `#channel).\n *\n * @param schema The editor schema to be used for suggestion nodes detection.\n */\nfunction rehypeSuggestions(schema: Schema): Transformer {\n const suggestionSchemaPartialRegex = buildSuggestionSchemaPartialRegex(schema)\n\n // Return the tree as-is if the editor does not support suggestions\n if (!suggestionSchemaPartialRegex) {\n return (tree: HastNode) => tree\n }\n\n return (...[tree]: Parameters<Transformer>): ReturnType<Transformer> => {\n const suggestionSchemaRegex = new RegExp(`^${suggestionSchemaPartialRegex}`)\n\n visit(tree, 'element', (node: HastNode) => {\n if (\n isHastElementNode(node, 'a') &&\n suggestionSchemaRegex.test(String(node.properties?.href))\n ) {\n const [, schema, id] =\n /^([a-z-]+):\\/\\/(\\S+)$/i.exec(String(node.properties?.href)) || []\n\n // Replace the link element with a span containing the suggestion attributes\n if (schema && id && isHastTextNode(node.children[0])) {\n node.tagName = 'span'\n node.properties = {\n [`data-${schema}`]: '',\n 'data-id': id,\n 'data-label': node.children[0].value,\n }\n node.children = []\n }\n }\n })\n\n return tree\n }\n}\n\nexport { rehypeSuggestions }\n"],"mappings":";;;;;;;;;AAcA,SAAS,kBAAkB,QAA6B;CACpD,MAAM,+BAA+B,kCAAkC,OAAO;AAG9E,KAAI,CAAC,6BACD,SAAQ,SAAmB;AAG/B,SAAQ,GAAG,CAAC,UAA4D;EACpE,MAAM,wBAAwB,IAAI,OAAO,IAAI,+BAA+B;AAE5E,QAAM,MAAM,YAAY,SAAmB;AACvC,OACI,kBAAkB,MAAM,IAAI,IAC5B,sBAAsB,KAAK,OAAO,KAAK,YAAY,KAAK,CAAC,EAC3D;IACE,MAAM,GAAG,QAAQ,MACb,yBAAyB,KAAK,OAAO,KAAK,YAAY,KAAK,CAAC,IAAI,EAAE;AAGtE,QAAI,UAAU,MAAM,eAAe,KAAK,SAAS,GAAG,EAAE;AAClD,UAAK,UAAU;AACf,UAAK,aAAa;OACb,QAAQ,WAAW;MACpB,WAAW;MACX,cAAc,KAAK,SAAS,GAAG;MAClC;AACD,UAAK,WAAW,EAAE;;;IAG5B;AAEF,SAAO"}
@@ -1,36 +1,35 @@
1
- import { visit } from 'unist-util-visit';
2
- import { isHastElementNode, isHastTextNode } from '../../../helpers/unified';
1
+ import { isHastElementNode, isHastTextNode } from "../../../helpers/unified.js";
2
+ import { visit } from "unist-util-visit";
3
+ //#region src/serializers/html/plugins/rehype-task-list.ts
3
4
  /**
4
- * A rehype plugin to add support for Tiptap task lists (i.e., `* [ ] Task`).
5
- */
5
+ * A rehype plugin to add support for Tiptap task lists (i.e., `* [ ] Task`).
6
+ */
6
7
  function rehypeTaskList() {
7
- return (...[tree]) => {
8
- visit(tree, 'element', (node) => {
9
- if (isHastElementNode(node, 'ul')) {
10
- const areAllChildrenTaskItems = node.children.every((c) => isHastElementNode(c, 'li') &&
11
- isHastTextNode(c.children[0]) &&
12
- /^\[[ x]\] /i.test(c.children[0].value));
13
- // Add the required attributes to the list and list items if all children are tasks,
14
- // removing the `[ ] ` or `[x] ` at the beginning of the task item text
15
- if (areAllChildrenTaskItems) {
16
- node.properties = {
17
- ...node.properties,
18
- 'data-type': 'taskList',
19
- };
20
- node.children.forEach((c) => {
21
- if (isHastElementNode(c, 'li') && isHastTextNode(c.children[0])) {
22
- c.properties = {
23
- ...c.properties,
24
- 'data-type': 'taskItem',
25
- 'data-checked': String(/^\[x\]/i.test(c.children[0].value)),
26
- };
27
- c.children[0].value = c.children[0].value.substring(4).trim();
28
- }
29
- });
30
- }
31
- }
32
- });
33
- return tree;
34
- };
8
+ return (...[tree]) => {
9
+ visit(tree, "element", (node) => {
10
+ if (isHastElementNode(node, "ul")) {
11
+ if (node.children.every((c) => isHastElementNode(c, "li") && isHastTextNode(c.children[0]) && /^\[[ x]\] /i.test(c.children[0].value))) {
12
+ node.properties = {
13
+ ...node.properties,
14
+ "data-type": "taskList"
15
+ };
16
+ node.children.forEach((c) => {
17
+ if (isHastElementNode(c, "li") && isHastTextNode(c.children[0])) {
18
+ c.properties = {
19
+ ...c.properties,
20
+ "data-type": "taskItem",
21
+ "data-checked": String(/^\[x\]/i.test(c.children[0].value))
22
+ };
23
+ c.children[0].value = c.children[0].value.substring(4).trim();
24
+ }
25
+ });
26
+ }
27
+ }
28
+ });
29
+ return tree;
30
+ };
35
31
  }
32
+ //#endregion
36
33
  export { rehypeTaskList };
34
+
35
+ //# sourceMappingURL=rehype-task-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rehype-task-list.js","names":[],"sources":["../../../../src/serializers/html/plugins/rehype-task-list.ts"],"sourcesContent":["import { visit } from 'unist-util-visit'\n\nimport { isHastElementNode, isHastTextNode } from '../../../helpers/unified'\n\nimport type { Node as HastNode } from 'hast'\nimport type { Transformer } from 'unified'\n\n/**\n * A rehype plugin to add support for Tiptap task lists (i.e., `* [ ] Task`).\n */\nfunction rehypeTaskList(): Transformer {\n return (...[tree]: Parameters<Transformer>): ReturnType<Transformer> => {\n visit(tree, 'element', (node: HastNode) => {\n if (isHastElementNode(node, 'ul')) {\n const areAllChildrenTaskItems = node.children.every(\n (c) =>\n isHastElementNode(c, 'li') &&\n isHastTextNode(c.children[0]) &&\n /^\\[[ x]\\] /i.test(c.children[0].value),\n )\n\n // Add the required attributes to the list and list items if all children are tasks,\n // removing the `[ ] ` or `[x] ` at the beginning of the task item text\n if (areAllChildrenTaskItems) {\n node.properties = {\n ...node.properties,\n 'data-type': 'taskList',\n }\n\n node.children.forEach((c) => {\n if (isHastElementNode(c, 'li') && isHastTextNode(c.children[0])) {\n c.properties = {\n ...c.properties,\n 'data-type': 'taskItem',\n 'data-checked': String(/^\\[x\\]/i.test(c.children[0].value)),\n }\n\n c.children[0].value = c.children[0].value.substring(4).trim()\n }\n })\n }\n }\n })\n\n return tree\n }\n}\n\nexport { rehypeTaskList }\n"],"mappings":";;;;;;AAUA,SAAS,iBAA8B;AACnC,SAAQ,GAAG,CAAC,UAA4D;AACpE,QAAM,MAAM,YAAY,SAAmB;AACvC,OAAI,kBAAkB,MAAM,KAAK;QACG,KAAK,SAAS,OACzC,MACG,kBAAkB,GAAG,KAAK,IAC1B,eAAe,EAAE,SAAS,GAAG,IAC7B,cAAc,KAAK,EAAE,SAAS,GAAG,MAAM,CAC9C,EAI4B;AACzB,UAAK,aAAa;MACd,GAAG,KAAK;MACR,aAAa;MAChB;AAED,UAAK,SAAS,SAAS,MAAM;AACzB,UAAI,kBAAkB,GAAG,KAAK,IAAI,eAAe,EAAE,SAAS,GAAG,EAAE;AAC7D,SAAE,aAAa;QACX,GAAG,EAAE;QACL,aAAa;QACb,gBAAgB,OAAO,UAAU,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;QAC9D;AAED,SAAE,SAAS,GAAG,QAAQ,EAAE,SAAS,GAAG,MAAM,UAAU,EAAE,CAAC,MAAM;;OAEnE;;;IAGZ;AAEF,SAAO"}
@@ -1,4 +1,6 @@
1
- import type { Processor } from 'unified';
1
+ import { Processor } from "unified";
2
+
3
+ //#region src/serializers/html/plugins/remark-autolink-literal.d.ts
2
4
  /**
3
5
  * A remark plugin to add support for the autolink literals extension extension from the GitHub
4
6
  * Flavored Markdown (GFM) specification.
@@ -13,5 +15,6 @@ import type { Processor } from 'unified';
13
15
  * @param options Configuration options for the plugin.
14
16
  */
15
17
  declare function remarkAutolinkLiteral(this: Processor): void;
18
+ //#endregion
16
19
  export { remarkAutolinkLiteral };
17
20
  //# sourceMappingURL=remark-autolink-literal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remark-autolink-literal.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/remark-autolink-literal.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC;;;;;;;;;;;;GAYG;AACH,iBAAS,qBAAqB,CAAC,IAAI,EAAE,SAAS,QAU7C;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
1
+ {"version":3,"file":"remark-autolink-literal.d.ts","names":[],"sources":["../../../../src/serializers/html/plugins/remark-autolink-literal.ts"],"mappings":";;;;;AAMwC;;;;;;;;;;;iBAe/B,qBAAA,CAAsB,IAAA,EAAM,SAAA"}
@@ -1,25 +1,29 @@
1
- import { gfmAutolinkLiteralFromMarkdown, gfmAutolinkLiteralToMarkdown, } from 'mdast-util-gfm-autolink-literal';
2
- import { gfmAutolinkLiteral } from 'micromark-extension-gfm-autolink-literal';
1
+ import { gfmAutolinkLiteralFromMarkdown, gfmAutolinkLiteralToMarkdown } from "mdast-util-gfm-autolink-literal";
2
+ import { gfmAutolinkLiteral } from "micromark-extension-gfm-autolink-literal";
3
+ //#region src/serializers/html/plugins/remark-autolink-literal.ts
3
4
  /**
4
- * A remark plugin to add support for the autolink literals extension extension from the GitHub
5
- * Flavored Markdown (GFM) specification.
6
- *
7
- * This is an standalone plugin which makes use of both the `mdast-util-gfm-autolink-literal` and
8
- * `micromark-extension-gfm-autolink-literal` packages, and the implementation is inspired by the
9
- * third-party `remark-gfm` plugin.
10
- *
11
- * The reason why we don't use `remark-gfm` directly is because we don't want to support all other
12
- * GFM features (footnotes, tables, tagfilter, and tasklists).
13
- *
14
- * @param options Configuration options for the plugin.
15
- */
5
+ * A remark plugin to add support for the autolink literals extension extension from the GitHub
6
+ * Flavored Markdown (GFM) specification.
7
+ *
8
+ * This is an standalone plugin which makes use of both the `mdast-util-gfm-autolink-literal` and
9
+ * `micromark-extension-gfm-autolink-literal` packages, and the implementation is inspired by the
10
+ * third-party `remark-gfm` plugin.
11
+ *
12
+ * The reason why we don't use `remark-gfm` directly is because we don't want to support all other
13
+ * GFM features (footnotes, tables, tagfilter, and tasklists).
14
+ *
15
+ * @param options Configuration options for the plugin.
16
+ */
16
17
  function remarkAutolinkLiteral() {
17
- const data = this.data();
18
- const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
19
- const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
20
- const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
21
- micromarkExtensions.push(gfmAutolinkLiteral());
22
- fromMarkdownExtensions.push(gfmAutolinkLiteralFromMarkdown());
23
- toMarkdownExtensions.push(gfmAutolinkLiteralToMarkdown());
18
+ const data = this.data();
19
+ const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
20
+ const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
21
+ const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
22
+ micromarkExtensions.push(gfmAutolinkLiteral());
23
+ fromMarkdownExtensions.push(gfmAutolinkLiteralFromMarkdown());
24
+ toMarkdownExtensions.push(gfmAutolinkLiteralToMarkdown());
24
25
  }
26
+ //#endregion
25
27
  export { remarkAutolinkLiteral };
28
+
29
+ //# sourceMappingURL=remark-autolink-literal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark-autolink-literal.js","names":[],"sources":["../../../../src/serializers/html/plugins/remark-autolink-literal.ts"],"sourcesContent":["import {\n gfmAutolinkLiteralFromMarkdown,\n gfmAutolinkLiteralToMarkdown,\n} from 'mdast-util-gfm-autolink-literal'\nimport { gfmAutolinkLiteral } from 'micromark-extension-gfm-autolink-literal'\n\nimport type { Processor } from 'unified'\n\n/**\n * A remark plugin to add support for the autolink literals extension extension from the GitHub\n * Flavored Markdown (GFM) specification.\n *\n * This is an standalone plugin which makes use of both the `mdast-util-gfm-autolink-literal` and\n * `micromark-extension-gfm-autolink-literal` packages, and the implementation is inspired by the\n * third-party `remark-gfm` plugin.\n *\n * The reason why we don't use `remark-gfm` directly is because we don't want to support all other\n * GFM features (footnotes, tables, tagfilter, and tasklists).\n *\n * @param options Configuration options for the plugin.\n */\nfunction remarkAutolinkLiteral(this: Processor) {\n const data = this.data()\n\n const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = [])\n const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = [])\n const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = [])\n\n micromarkExtensions.push(gfmAutolinkLiteral())\n fromMarkdownExtensions.push(gfmAutolinkLiteralFromMarkdown())\n toMarkdownExtensions.push(gfmAutolinkLiteralToMarkdown())\n}\n\nexport { remarkAutolinkLiteral }\n"],"mappings":";;;;;;;;;;;;;;;;AAqBA,SAAS,wBAAuC;CAC5C,MAAM,OAAO,KAAK,MAAM;CAExB,MAAM,sBAAsB,KAAK,wBAAwB,KAAK,sBAAsB,EAAE;CACtF,MAAM,yBAAyB,KAAK,2BAA2B,KAAK,yBAAyB,EAAE;CAC/F,MAAM,uBAAuB,KAAK,yBAAyB,KAAK,uBAAuB,EAAE;AAEzF,qBAAoB,KAAK,oBAAoB,CAAC;AAC9C,wBAAuB,KAAK,gCAAgC,CAAC;AAC7D,sBAAqB,KAAK,8BAA8B,CAAC"}
@@ -1,45 +1,25 @@
1
+ //#region src/serializers/html/plugins/remark-disable-constructs.ts
1
2
  /**
2
- * A remark plugin to disable multiple language constructs based on the availability of marks and/or
3
- * nodes in the given editor schema.
4
- *
5
- * @param schema The editor schema to be used for nodes and marks detection.
6
- */
3
+ * A remark plugin to disable multiple language constructs based on the availability of marks and/or
4
+ * nodes in the given editor schema.
5
+ *
6
+ * @param schema The editor schema to be used for nodes and marks detection.
7
+ */
7
8
  function remarkDisableConstructs(schema) {
8
- const data = this.data();
9
- const disabledConstructs = [];
10
- if (!schema.nodes.blockquote) {
11
- disabledConstructs.push('blockQuote');
12
- }
13
- if (!schema.marks.bold || !schema.marks.italic) {
14
- disabledConstructs.push('attention');
15
- }
16
- if (!schema.nodes.bulletList || !schema.nodes.orderedList) {
17
- disabledConstructs.push('list');
18
- }
19
- if (!schema.marks.code) {
20
- disabledConstructs.push('codeText');
21
- }
22
- if (!schema.nodes.codeBlock) {
23
- disabledConstructs.push('codeFenced', 'codeIndented');
24
- }
25
- if (!schema.nodes.heading) {
26
- disabledConstructs.push('headingAtx');
27
- }
28
- if (!schema.nodes.horizontalRule) {
29
- disabledConstructs.push('thematicBreak');
30
- }
31
- if (!schema.nodes.image) {
32
- disabledConstructs.push('labelStartImage');
33
- }
34
- if (!schema.marks.link) {
35
- disabledConstructs.push('labelStartLink');
36
- }
37
- const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
38
- // https://github.com/micromark/micromark#case-turn-off-constructs
39
- micromarkExtensions.push({
40
- disable: {
41
- null: disabledConstructs,
42
- },
43
- });
9
+ const data = this.data();
10
+ const disabledConstructs = [];
11
+ if (!schema.nodes.blockquote) disabledConstructs.push("blockQuote");
12
+ if (!schema.marks.bold || !schema.marks.italic) disabledConstructs.push("attention");
13
+ if (!schema.nodes.bulletList || !schema.nodes.orderedList) disabledConstructs.push("list");
14
+ if (!schema.marks.code) disabledConstructs.push("codeText");
15
+ if (!schema.nodes.codeBlock) disabledConstructs.push("codeFenced", "codeIndented");
16
+ if (!schema.nodes.heading) disabledConstructs.push("headingAtx");
17
+ if (!schema.nodes.horizontalRule) disabledConstructs.push("thematicBreak");
18
+ if (!schema.nodes.image) disabledConstructs.push("labelStartImage");
19
+ if (!schema.marks.link) disabledConstructs.push("labelStartLink");
20
+ (data.micromarkExtensions || (data.micromarkExtensions = [])).push({ disable: { null: disabledConstructs } });
44
21
  }
22
+ //#endregion
45
23
  export { remarkDisableConstructs };
24
+
25
+ //# sourceMappingURL=remark-disable-constructs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark-disable-constructs.js","names":[],"sources":["../../../../src/serializers/html/plugins/remark-disable-constructs.ts"],"sourcesContent":["import type { Schema } from '@tiptap/pm/model'\nimport type { Processor } from 'unified'\n\n/**\n * A remark plugin to disable multiple language constructs based on the availability of marks and/or\n * nodes in the given editor schema.\n *\n * @param schema The editor schema to be used for nodes and marks detection.\n */\nfunction remarkDisableConstructs(this: Processor, schema: Schema) {\n const data = this.data()\n\n const disabledConstructs: string[] = []\n\n if (!schema.nodes.blockquote) {\n disabledConstructs.push('blockQuote')\n }\n\n if (!schema.marks.bold || !schema.marks.italic) {\n disabledConstructs.push('attention')\n }\n\n if (!schema.nodes.bulletList || !schema.nodes.orderedList) {\n disabledConstructs.push('list')\n }\n\n if (!schema.marks.code) {\n disabledConstructs.push('codeText')\n }\n\n if (!schema.nodes.codeBlock) {\n disabledConstructs.push('codeFenced', 'codeIndented')\n }\n\n if (!schema.nodes.heading) {\n disabledConstructs.push('headingAtx')\n }\n\n if (!schema.nodes.horizontalRule) {\n disabledConstructs.push('thematicBreak')\n }\n\n if (!schema.nodes.image) {\n disabledConstructs.push('labelStartImage')\n }\n\n if (!schema.marks.link) {\n disabledConstructs.push('labelStartLink')\n }\n\n const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = [])\n\n // https://github.com/micromark/micromark#case-turn-off-constructs\n micromarkExtensions.push({\n disable: {\n null: disabledConstructs,\n },\n })\n}\n\nexport { remarkDisableConstructs }\n"],"mappings":";;;;;;;AASA,SAAS,wBAAyC,QAAgB;CAC9D,MAAM,OAAO,KAAK,MAAM;CAExB,MAAM,qBAA+B,EAAE;AAEvC,KAAI,CAAC,OAAO,MAAM,WACd,oBAAmB,KAAK,aAAa;AAGzC,KAAI,CAAC,OAAO,MAAM,QAAQ,CAAC,OAAO,MAAM,OACpC,oBAAmB,KAAK,YAAY;AAGxC,KAAI,CAAC,OAAO,MAAM,cAAc,CAAC,OAAO,MAAM,YAC1C,oBAAmB,KAAK,OAAO;AAGnC,KAAI,CAAC,OAAO,MAAM,KACd,oBAAmB,KAAK,WAAW;AAGvC,KAAI,CAAC,OAAO,MAAM,UACd,oBAAmB,KAAK,cAAc,eAAe;AAGzD,KAAI,CAAC,OAAO,MAAM,QACd,oBAAmB,KAAK,aAAa;AAGzC,KAAI,CAAC,OAAO,MAAM,eACd,oBAAmB,KAAK,gBAAgB;AAG5C,KAAI,CAAC,OAAO,MAAM,MACd,oBAAmB,KAAK,kBAAkB;AAG9C,KAAI,CAAC,OAAO,MAAM,KACd,oBAAmB,KAAK,iBAAiB;AAM7C,EAH4B,KAAK,wBAAwB,KAAK,sBAAsB,EAAE,GAGlE,KAAK,EACrB,SAAS,EACL,MAAM,oBACT,EACJ,CAAC"}
@@ -1,5 +1,7 @@
1
- import type { Options } from 'micromark-extension-gfm-strikethrough';
2
- import type { Processor } from 'unified';
1
+ import { Processor } from "unified";
2
+ import { Options } from "micromark-extension-gfm-strikethrough";
3
+
4
+ //#region src/serializers/html/plugins/remark-strikethrough.d.ts
3
5
  /**
4
6
  * A remark plugin to add support for the strikethrough extension from the GitHub Flavored Markdown
5
7
  * (GFM) specification.
@@ -14,5 +16,6 @@ import type { Processor } from 'unified';
14
16
  * @param options Configuration options for the plugin.
15
17
  */
16
18
  declare function remarkStrikethrough(this: Processor, options?: Options): void;
19
+ //#endregion
17
20
  export { remarkStrikethrough };
18
21
  //# sourceMappingURL=remark-strikethrough.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remark-strikethrough.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/remark-strikethrough.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAA;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC;;;;;;;;;;;;GAYG;AACH,iBAAS,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAE,OAAY,QAUlE;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
1
+ {"version":3,"file":"remark-strikethrough.d.ts","names":[],"sources":["../../../../src/serializers/html/plugins/remark-strikethrough.ts"],"mappings":";;;;;;AAOwC;;;;;;;;;;;iBAe/B,mBAAA,CAAoB,IAAA,EAAM,SAAA,EAAW,OAAA,GAAS,OAAA"}
@@ -1,25 +1,29 @@
1
- import { gfmStrikethroughFromMarkdown, gfmStrikethroughToMarkdown, } from 'mdast-util-gfm-strikethrough';
2
- import { gfmStrikethrough } from 'micromark-extension-gfm-strikethrough';
1
+ import { gfmStrikethroughFromMarkdown, gfmStrikethroughToMarkdown } from "mdast-util-gfm-strikethrough";
2
+ import { gfmStrikethrough } from "micromark-extension-gfm-strikethrough";
3
+ //#region src/serializers/html/plugins/remark-strikethrough.ts
3
4
  /**
4
- * A remark plugin to add support for the strikethrough extension from the GitHub Flavored Markdown
5
- * (GFM) specification.
6
- *
7
- * This is an standalone plugin which makes use of both the `mdast-util-gfm-strikethrough` and
8
- * `micromark-extension-gfm-strikethrough` packages, and the implementation is inspired by the
9
- * third-party `remark-gfm` plugin.
10
- *
11
- * The reason why we don't use `remark-gfm` directly is because we don't want to support all other
12
- * GFM features (footnotes, tables, tagfilter, and tasklists).
13
- *
14
- * @param options Configuration options for the plugin.
15
- */
5
+ * A remark plugin to add support for the strikethrough extension from the GitHub Flavored Markdown
6
+ * (GFM) specification.
7
+ *
8
+ * This is an standalone plugin which makes use of both the `mdast-util-gfm-strikethrough` and
9
+ * `micromark-extension-gfm-strikethrough` packages, and the implementation is inspired by the
10
+ * third-party `remark-gfm` plugin.
11
+ *
12
+ * The reason why we don't use `remark-gfm` directly is because we don't want to support all other
13
+ * GFM features (footnotes, tables, tagfilter, and tasklists).
14
+ *
15
+ * @param options Configuration options for the plugin.
16
+ */
16
17
  function remarkStrikethrough(options = {}) {
17
- const data = this.data();
18
- const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
19
- const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
20
- const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
21
- micromarkExtensions.push(gfmStrikethrough(options));
22
- fromMarkdownExtensions.push(gfmStrikethroughFromMarkdown());
23
- toMarkdownExtensions.push(gfmStrikethroughToMarkdown());
18
+ const data = this.data();
19
+ const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
20
+ const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
21
+ const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
22
+ micromarkExtensions.push(gfmStrikethrough(options));
23
+ fromMarkdownExtensions.push(gfmStrikethroughFromMarkdown());
24
+ toMarkdownExtensions.push(gfmStrikethroughToMarkdown());
24
25
  }
26
+ //#endregion
25
27
  export { remarkStrikethrough };
28
+
29
+ //# sourceMappingURL=remark-strikethrough.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark-strikethrough.js","names":[],"sources":["../../../../src/serializers/html/plugins/remark-strikethrough.ts"],"sourcesContent":["import {\n gfmStrikethroughFromMarkdown,\n gfmStrikethroughToMarkdown,\n} from 'mdast-util-gfm-strikethrough'\nimport { gfmStrikethrough } from 'micromark-extension-gfm-strikethrough'\n\nimport type { Options } from 'micromark-extension-gfm-strikethrough'\nimport type { Processor } from 'unified'\n\n/**\n * A remark plugin to add support for the strikethrough extension from the GitHub Flavored Markdown\n * (GFM) specification.\n *\n * This is an standalone plugin which makes use of both the `mdast-util-gfm-strikethrough` and\n * `micromark-extension-gfm-strikethrough` packages, and the implementation is inspired by the\n * third-party `remark-gfm` plugin.\n *\n * The reason why we don't use `remark-gfm` directly is because we don't want to support all other\n * GFM features (footnotes, tables, tagfilter, and tasklists).\n *\n * @param options Configuration options for the plugin.\n */\nfunction remarkStrikethrough(this: Processor, options: Options = {}) {\n const data = this.data()\n\n const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = [])\n const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = [])\n const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = [])\n\n micromarkExtensions.push(gfmStrikethrough(options))\n fromMarkdownExtensions.push(gfmStrikethroughFromMarkdown())\n toMarkdownExtensions.push(gfmStrikethroughToMarkdown())\n}\n\nexport { remarkStrikethrough }\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,SAAS,oBAAqC,UAAmB,EAAE,EAAE;CACjE,MAAM,OAAO,KAAK,MAAM;CAExB,MAAM,sBAAsB,KAAK,wBAAwB,KAAK,sBAAsB,EAAE;CACtF,MAAM,yBAAyB,KAAK,2BAA2B,KAAK,yBAAyB,EAAE;CAC/F,MAAM,uBAAuB,KAAK,yBAAyB,KAAK,uBAAuB,EAAE;AAEzF,qBAAoB,KAAK,iBAAiB,QAAQ,CAAC;AACnD,wBAAuB,KAAK,8BAA8B,CAAC;AAC3D,sBAAqB,KAAK,4BAA4B,CAAC"}
@@ -1,21 +1,22 @@
1
- import type { Schema } from '@tiptap/pm/model';
1
+ import { Schema } from "@tiptap/pm/model";
2
+
3
+ //#region src/serializers/markdown/markdown.d.ts
2
4
  /**
3
5
  * The return type for the `createMarkdownSerializer` function.
4
6
  */
5
7
  type MarkdownSerializerReturnType = {
6
- /**
7
- * Serializes an input HTML string to an output Markdown string.
8
- *
9
- * @param html The HTML string to serialize.
10
- *
11
- * @returns The serialized Markdown.
12
- */
13
- serialize: (html: string) => string;
8
+ /**
9
+ * Serializes an input HTML string to an output Markdown string.
10
+ *
11
+ * @param html The HTML string to serialize.
12
+ *
13
+ * @returns The serialized Markdown.
14
+ */
15
+ serialize: (html: string) => string;
14
16
  };
15
17
  /**
16
18
  * The bullet list marker for both standard and task list items.
17
19
  */
18
- declare const BULLET_LIST_MARKER = "-";
19
20
  /**
20
21
  * Create an HTML to Markdown serializer with the Turndown library for both a rich-text editor, and
21
22
  * a plain-text editor. The editor schema is used to detect which nodes and marks are available in
@@ -38,6 +39,6 @@ declare function createMarkdownSerializer(schema: Schema): MarkdownSerializerRet
38
39
  * @returns The Markdown serializer instance for the given editor schema.
39
40
  */
40
41
  declare function getMarkdownSerializerInstance(schema: Schema): MarkdownSerializerReturnType;
41
- export { BULLET_LIST_MARKER, createMarkdownSerializer, getMarkdownSerializerInstance };
42
- export type { MarkdownSerializerReturnType };
42
+ //#endregion
43
+ export { createMarkdownSerializer, getMarkdownSerializerInstance };
43
44
  //# sourceMappingURL=markdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/serializers/markdown/markdown.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;GAEG;AACH,KAAK,4BAA4B,GAAG;IAChC;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CACtC,CAAA;AASD;;GAEG;AACH,QAAA,MAAM,kBAAkB,MAAM,CAAA;AA8C9B;;;;;;;;;;;;GAYG;AACH,iBAAS,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,4BAA4B,CAgG9E;AAOD;;;;;;GAMG;AACH,iBAAS,6BAA6B,CAAC,MAAM,EAAE,MAAM,gCAQpD;AAED,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,CAAA;AAEtF,YAAY,EAAE,4BAA4B,EAAE,CAAA"}
1
+ {"version":3,"file":"markdown.d.ts","names":[],"sources":["../../../src/serializers/markdown/markdown.ts"],"mappings":";;;;;AAY8C;KAKzC,4BAAA;;;;AAqBmB;;;;EAbpB,SAAA,GAAY,IAAA;AAAA;;;;;;;;;;;;;;;;;iBAwEP,wBAAA,CAAyB,MAAA,EAAQ,MAAA,GAAS,4BAAA;;;;;;;;iBA8G1C,6BAAA,CAA8B,MAAA,EAAQ,MAAA,GAAM,4BAAA"}