@doist/typist 2.3.1 → 4.0.0

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 (29) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/extensions/rich-text/rich-text-bullet-list.d.ts +13 -20
  3. package/dist/extensions/rich-text/rich-text-bullet-list.d.ts.map +1 -1
  4. package/dist/extensions/rich-text/rich-text-bullet-list.js +34 -25
  5. package/dist/extensions/rich-text/rich-text-ordered-list.d.ts +13 -20
  6. package/dist/extensions/rich-text/rich-text-ordered-list.d.ts.map +1 -1
  7. package/dist/extensions/rich-text/rich-text-ordered-list.js +34 -25
  8. package/dist/helpers/unified.d.ts +15 -5
  9. package/dist/helpers/unified.d.ts.map +1 -1
  10. package/dist/helpers/unified.js +15 -4
  11. package/dist/index.d.ts +2 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +2 -0
  14. package/dist/serializers/html/html.js +1 -1
  15. package/dist/serializers/html/plugins/rehype-code-block.d.ts.map +1 -1
  16. package/dist/serializers/html/plugins/rehype-code-block.js +4 -5
  17. package/dist/serializers/html/plugins/rehype-image.d.ts.map +1 -1
  18. package/dist/serializers/html/plugins/rehype-image.js +4 -4
  19. package/dist/serializers/html/plugins/rehype-suggestions.d.ts.map +1 -1
  20. package/dist/serializers/html/plugins/rehype-suggestions.js +4 -4
  21. package/dist/serializers/html/plugins/rehype-task-list.d.ts.map +1 -1
  22. package/dist/serializers/html/plugins/rehype-task-list.js +5 -6
  23. package/dist/serializers/html/plugins/remark-autolink-literal.d.ts.map +1 -1
  24. package/dist/serializers/html/plugins/remark-autolink-literal.js +6 -7
  25. package/dist/serializers/html/plugins/remark-disable-constructs.d.ts.map +1 -1
  26. package/dist/serializers/html/plugins/remark-disable-constructs.js +2 -5
  27. package/dist/serializers/html/plugins/remark-strikethrough.d.ts.map +1 -1
  28. package/dist/serializers/html/plugins/remark-strikethrough.js +6 -7
  29. package/package.json +36 -31
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## [4.0.0](https://github.com/Doist/typist/compare/v3.0.0...v4.0.0) (2024-01-30)
2
+
3
+ ### ⚠ BREAKING CHANGES
4
+
5
+ - **deps:** update unified ecosystem dependencies (#395)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **deps:** update unified ecosystem dependencies ([#395](https://github.com/Doist/typist/issues/395)) ([e97ad83](https://github.com/Doist/typist/commit/e97ad83e7015cf49044bc72cf8ef6dce1be1f2c8))
10
+
11
+ ## [3.0.0](https://github.com/Doist/typist/compare/v2.3.1...v3.0.0) (2024-01-18)
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ - **extensions:** The `smartToggleBulletList` and
16
+ `smartToggleOrderedList` commands were renamed to have the same name as
17
+ the built-in toggle functions so that they can easily be used by the
18
+ default keyboard shortcuts without having to change the
19
+ `addKeyboardShortcuts` function.
20
+
21
+ The `BulletList` and `OrderedList` extensions now take an additional
22
+ option, `smartToggle` (default: `false`), that indicates whether hard
23
+ breaks should be replaced by paragraphs before toggling the
24
+ selection into a bullet/ordered list, or not.
25
+
26
+ ### Features
27
+
28
+ - **extensions:** Overwrite built-in List/Ordered toggle functions with a `smartToggle` option ([#620](https://github.com/Doist/typist/issues/620)) ([059da61](https://github.com/Doist/typist/commit/059da61605370f8a3534d3c7669acbc952ea40d3))
29
+
1
30
  ## [2.3.1](https://github.com/Doist/typist/compare/v2.3.0...v2.3.1) (2024-01-17)
2
31
 
3
32
  ### Bug Fixes
@@ -1,27 +1,20 @@
1
1
  import type { BulletListOptions } from '@tiptap/extension-bullet-list';
2
2
  /**
3
- * Augment the official `@tiptap/core` module with extra commands, relevant for this extension, so
4
- * that the compiler knows about them.
3
+ * The options available to customize the `RichTextBulletList` extension.
5
4
  */
6
- declare module '@tiptap/core' {
7
- interface Commands<ReturnType> {
8
- richTextBulletList: {
9
- /**
10
- * Smartly toggles the selection into a bullet list, converting any hard breaks into
11
- * paragraphs before doing so.
12
- *
13
- * @see https://discuss.prosemirror.net/t/how-to-convert-a-selection-of-text-lines-into-paragraphs/6099
14
- */
15
- smartToggleBulletList: () => ReturnType;
16
- };
17
- }
18
- }
5
+ type RichTextBulletListOptions = {
6
+ /**
7
+ * Replace hard breaks in the selection with paragraphs before toggling the selection into a
8
+ * bullet list. By default, hard breaks are not replaced.
9
+ */
10
+ smartToggle: boolean;
11
+ } & BulletListOptions;
19
12
  /**
20
- * Custom extension that extends the built-in `BulletList` extension to add a smart toggle command
21
- * with support for hard breaks, which are automatically converted into paragraphs before toggling
22
- * the selection into a bullet list.
13
+ * Custom extension that extends the built-in `BulletList` extension to add an option for smart
14
+ * toggling, which takes into account hard breaks in the selection, and converts them into
15
+ * paragraphs before toggling the selection into a bullet list.
23
16
  */
24
- declare const RichTextBulletList: import("@tiptap/core").Node<BulletListOptions, any>;
17
+ declare const RichTextBulletList: import("@tiptap/core").Node<RichTextBulletListOptions, any>;
25
18
  export { RichTextBulletList };
26
- export type { BulletListOptions as RichTextBulletListOptions };
19
+ export type { RichTextBulletListOptions };
27
20
  //# sourceMappingURL=rich-text-bullet-list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rich-text-bullet-list.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/rich-text-bullet-list.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAEtE;;;GAGG;AACH,OAAO,QAAQ,cAAc,CAAC;IAC1B,UAAU,QAAQ,CAAC,UAAU;QACzB,kBAAkB,EAAE;YAChB;;;;;eAKG;YACH,qBAAqB,EAAE,MAAM,UAAU,CAAA;SAC1C,CAAA;KACJ;CACJ;AAED;;;;GAIG;AACH,QAAA,MAAM,kBAAkB,qDAqDtB,CAAA;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAE7B,YAAY,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,CAAA"}
1
+ {"version":3,"file":"rich-text-bullet-list.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/rich-text-bullet-list.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAEtE;;GAEG;AACH,KAAK,yBAAyB,GAAG;IAC7B;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAA;CACvB,GAAG,iBAAiB,CAAA;AAErB;;;;GAIG;AACH,QAAA,MAAM,kBAAkB,6DA+DtB,CAAA;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAE7B,YAAY,EAAE,yBAAyB,EAAE,CAAA"}
@@ -3,39 +3,48 @@ import { ListItem } from '@tiptap/extension-list-item';
3
3
  import { TextStyle } from '@tiptap/extension-text-style';
4
4
  import { Fragment, Slice } from '@tiptap/pm/model';
5
5
  /**
6
- * Custom extension that extends the built-in `BulletList` extension to add a smart toggle command
7
- * with support for hard breaks, which are automatically converted into paragraphs before toggling
8
- * the selection into a bullet list.
6
+ * Custom extension that extends the built-in `BulletList` extension to add an option for smart
7
+ * toggling, which takes into account hard breaks in the selection, and converts them into
8
+ * paragraphs before toggling the selection into a bullet list.
9
9
  */
10
10
  const RichTextBulletList = BulletList.extend({
11
+ addOptions() {
12
+ return {
13
+ ...this.parent?.(),
14
+ smartToggle: false,
15
+ };
16
+ },
11
17
  addCommands() {
12
18
  const { editor, name, options } = this;
13
19
  return {
14
20
  ...this.parent?.(),
15
- smartToggleBulletList() {
21
+ toggleBulletList() {
16
22
  return ({ commands, state, tr, chain }) => {
17
- const { schema } = state;
18
- const { selection } = tr;
19
- const { $from, $to } = selection;
20
- const hardBreakPositions = [];
21
- // Find and store the positions of all hard breaks in the selection
22
- tr.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
23
- if (node.type.name === 'hardBreak') {
24
- hardBreakPositions.push(pos);
25
- }
26
- });
27
- // Replace each hard break with a slice that closes and re-opens a paragraph,
28
- // effectively inserting a "paragraph break" in place of a "hard break"
29
- // (this is performed in reverse order to compensate for content shifting that
30
- // occurs with each replacement, ensuring accurate insertion points)
31
- hardBreakPositions.reverse().forEach((pos) => {
32
- tr.replace(pos, pos + 1, Slice.maxOpen(Fragment.fromArray([
33
- schema.nodes.paragraph.create(),
34
- schema.nodes.paragraph.create(),
35
- ])));
36
- });
23
+ // Replace hard breaks in the selection with paragraphs before toggling?
24
+ if (options.smartToggle) {
25
+ const { schema } = state;
26
+ const { selection } = tr;
27
+ const { $from, $to } = selection;
28
+ const hardBreakPositions = [];
29
+ // Find and store the positions of all hard breaks in the selection
30
+ tr.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
31
+ if (node.type.name === 'hardBreak') {
32
+ hardBreakPositions.push(pos);
33
+ }
34
+ });
35
+ // Replace each hard break with a slice that closes and re-opens a paragraph,
36
+ // effectively inserting a "paragraph break" in place of a "hard break"
37
+ // (this is performed in reverse order to compensate for content shifting that
38
+ // occurs with each replacement, ensuring accurate insertion points)
39
+ hardBreakPositions.reverse().forEach((pos) => {
40
+ tr.replace(pos, pos + 1, Slice.maxOpen(Fragment.fromArray([
41
+ schema.nodes.paragraph.create(),
42
+ schema.nodes.paragraph.create(),
43
+ ])));
44
+ });
45
+ }
37
46
  // Toggle the selection into a bullet list, optionally keeping attributes
38
- // (this is a verbatim copy of the built-in`toggleBulletList` command)
47
+ // (this is a verbatim copy of the built-in `toggleBulletList` command)
39
48
  if (options.keepAttributes) {
40
49
  return chain()
41
50
  .toggleList(name, options.itemTypeName, options.keepMarks)
@@ -1,27 +1,20 @@
1
1
  import type { OrderedListOptions } from '@tiptap/extension-ordered-list';
2
2
  /**
3
- * Augment the official `@tiptap/core` module with extra commands, relevant for this extension, so
4
- * that the compiler knows about them.
3
+ * The options available to customize the `RichTextOrderedList` extension.
5
4
  */
6
- declare module '@tiptap/core' {
7
- interface Commands<ReturnType> {
8
- richTextOrderedList: {
9
- /**
10
- * Smartly toggles the selection into an oredered list, converting any hard breaks into
11
- * paragraphs before doing so.
12
- *
13
- * @see https://discuss.prosemirror.net/t/how-to-convert-a-selection-of-text-lines-into-paragraphs/6099
14
- */
15
- smartToggleOrderedList: () => ReturnType;
16
- };
17
- }
18
- }
5
+ type RichTextOrderedListOptions = {
6
+ /**
7
+ * Replace hard breaks in the selection with paragraphs before toggling the selection into a
8
+ * bullet list. By default, hard breaks are not replaced.
9
+ */
10
+ smartToggle: boolean;
11
+ } & OrderedListOptions;
19
12
  /**
20
- * Custom extension that extends the built-in `OrderedList` extension to add a smart toggle command
21
- * with support for hard breaks, which are automatically converted into paragraphs before toggling
22
- * the selection into an ordered list.
13
+ * Custom extension that extends the built-in `OrderedList` extension to add an option for smart
14
+ * toggling, which takes into account hard breaks in the selection, and converts them into
15
+ * paragraphs before toggling the selection into a bullet list.
23
16
  */
24
- declare const RichTextOrderedList: import("@tiptap/core").Node<OrderedListOptions, any>;
17
+ declare const RichTextOrderedList: import("@tiptap/core").Node<RichTextOrderedListOptions, any>;
25
18
  export { RichTextOrderedList };
26
- export type { OrderedListOptions as RichTextOrderedListOptions };
19
+ export type { RichTextOrderedListOptions };
27
20
  //# sourceMappingURL=rich-text-ordered-list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rich-text-ordered-list.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/rich-text-ordered-list.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAExE;;;GAGG;AACH,OAAO,QAAQ,cAAc,CAAC;IAC1B,UAAU,QAAQ,CAAC,UAAU;QACzB,mBAAmB,EAAE;YACjB;;;;;eAKG;YACH,sBAAsB,EAAE,MAAM,UAAU,CAAA;SAC3C,CAAA;KACJ;CACJ;AAED;;;;GAIG;AACH,QAAA,MAAM,mBAAmB,sDAqDvB,CAAA;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAA;AAE9B,YAAY,EAAE,kBAAkB,IAAI,0BAA0B,EAAE,CAAA"}
1
+ {"version":3,"file":"rich-text-ordered-list.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/rich-text-ordered-list.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAExE;;GAEG;AACH,KAAK,0BAA0B,GAAG;IAC9B;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAA;CACvB,GAAG,kBAAkB,CAAA;AAEtB;;;;GAIG;AACH,QAAA,MAAM,mBAAmB,8DA+DvB,CAAA;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAA;AAE9B,YAAY,EAAE,0BAA0B,EAAE,CAAA"}
@@ -3,39 +3,48 @@ import { OrderedList } from '@tiptap/extension-ordered-list';
3
3
  import { TextStyle } from '@tiptap/extension-text-style';
4
4
  import { Fragment, Slice } from '@tiptap/pm/model';
5
5
  /**
6
- * Custom extension that extends the built-in `OrderedList` extension to add a smart toggle command
7
- * with support for hard breaks, which are automatically converted into paragraphs before toggling
8
- * the selection into an ordered list.
6
+ * Custom extension that extends the built-in `OrderedList` extension to add an option for smart
7
+ * toggling, which takes into account hard breaks in the selection, and converts them into
8
+ * paragraphs before toggling the selection into a bullet list.
9
9
  */
10
10
  const RichTextOrderedList = OrderedList.extend({
11
+ addOptions() {
12
+ return {
13
+ ...this.parent?.(),
14
+ smartToggle: false,
15
+ };
16
+ },
11
17
  addCommands() {
12
18
  const { editor, name, options } = this;
13
19
  return {
14
20
  ...this.parent?.(),
15
- smartToggleOrderedList() {
21
+ toggleOrderedList() {
16
22
  return ({ commands, state, tr, chain }) => {
17
- const { schema } = state;
18
- const { selection } = tr;
19
- const { $from, $to } = selection;
20
- const hardBreakPositions = [];
21
- // Find and store the positions of all hard breaks in the selection
22
- tr.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
23
- if (node.type.name === 'hardBreak') {
24
- hardBreakPositions.push(pos);
25
- }
26
- });
27
- // Replace each hard break with a slice that closes and re-opens a paragraph,
28
- // effectively inserting a "paragraph break" in place of a "hard break"
29
- // (this is performed in reverse order to compensate for content shifting that
30
- // occurs with each replacement, ensuring accurate insertion points)
31
- hardBreakPositions.reverse().forEach((pos) => {
32
- tr.replace(pos, pos + 1, Slice.maxOpen(Fragment.fromArray([
33
- schema.nodes.paragraph.create(),
34
- schema.nodes.paragraph.create(),
35
- ])));
36
- });
23
+ // Replace hard breaks in the selection with paragraphs before toggling?
24
+ if (options.smartToggle) {
25
+ const { schema } = state;
26
+ const { selection } = tr;
27
+ const { $from, $to } = selection;
28
+ const hardBreakPositions = [];
29
+ // Find and store the positions of all hard breaks in the selection
30
+ tr.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
31
+ if (node.type.name === 'hardBreak') {
32
+ hardBreakPositions.push(pos);
33
+ }
34
+ });
35
+ // Replace each hard break with a slice that closes and re-opens a paragraph,
36
+ // effectively inserting a "paragraph break" in place of a "hard break"
37
+ // (this is performed in reverse order to compensate for content shifting that
38
+ // occurs with each replacement, ensuring accurate insertion points)
39
+ hardBreakPositions.reverse().forEach((pos) => {
40
+ tr.replace(pos, pos + 1, Slice.maxOpen(Fragment.fromArray([
41
+ schema.nodes.paragraph.create(),
42
+ schema.nodes.paragraph.create(),
43
+ ])));
44
+ });
45
+ }
37
46
  // Toggle the selection into a bullet list, optionally keeping attributes
38
- // (this is a verbatim copy of the built-in`toggleBulletList` command)
47
+ // (this is a verbatim copy of the built-in `toggleBulletList` command)
39
48
  if (options.keepAttributes) {
40
49
  return chain()
41
50
  .toggleList(name, options.itemTypeName, options.keepMarks)
@@ -1,11 +1,21 @@
1
- import type { Node, Text } from 'hast';
1
+ import type { Element, Text } from 'hast';
2
+ import type { Node } from 'unist';
2
3
  /**
3
- * Check if a given node is a unist text node.
4
+ * Determines whether a given node is an hast element with a specific tag name.
4
5
  *
5
6
  * @param node The node to check.
7
+ * @param tagName The tag name to check for.
6
8
  *
7
- * @returns `true` if the node is a unist text node, `false` otherwise.
9
+ * @returns `true` if the node is an hast element with the specified tag name, `false` otherwise.
8
10
  */
9
- declare function isTextNode(node: Node): node is Text;
10
- export { isTextNode };
11
+ declare function isHastElement(node: Node, tagName: Element['tagName']): node is Element;
12
+ /**
13
+ * Determines whether a given node is hast a text node.
14
+ *
15
+ * @param node The node to check.
16
+ *
17
+ * @returns `true` if the node is a hast text node, `false` otherwise.
18
+ */
19
+ declare function isHastTextNode(node: Node): node is Text;
20
+ export { isHastElement, isHastTextNode };
11
21
  //# sourceMappingURL=unified.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unified.d.ts","sourceRoot":"","sources":["../../src/helpers/unified.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAEtC;;;;;;GAMG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,IAAI,CAE5C;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
1
+ {"version":3,"file":"unified.d.ts","sourceRoot":"","sources":["../../src/helpers/unified.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC;;;;;;;GAOG;AACH,iBAAS,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,OAAO,CAE/E;AAED;;;;;;GAMG;AACH,iBAAS,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,IAAI,CAEhD;AAED,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,CAAA"}
@@ -1,12 +1,23 @@
1
1
  import { is } from 'unist-util-is';
2
2
  /**
3
- * Check if a given node is a unist text node.
3
+ * Determines whether a given node is an hast element with a specific tag name.
4
4
  *
5
5
  * @param node The node to check.
6
+ * @param tagName The tag name to check for.
6
7
  *
7
- * @returns `true` if the node is a unist text node, `false` otherwise.
8
+ * @returns `true` if the node is an hast element with the specified tag name, `false` otherwise.
8
9
  */
9
- function isTextNode(node) {
10
+ function isHastElement(node, tagName) {
11
+ return is(node, { type: 'element', tagName });
12
+ }
13
+ /**
14
+ * Determines whether a given node is hast a text node.
15
+ *
16
+ * @param node The node to check.
17
+ *
18
+ * @returns `true` if the node is a hast text node, `false` otherwise.
19
+ */
20
+ function isHastTextNode(node) {
10
21
  return is(node, { type: 'text' });
11
22
  }
12
- export { isTextNode };
23
+ export { isHastElement, isHastTextNode };
package/dist/index.d.ts CHANGED
@@ -12,6 +12,8 @@ export type { SuggestionExtensionResult, SuggestionOptions, SuggestionRendererPr
12
12
  export { createSuggestionExtension } from './factories/create-suggestion-extension';
13
13
  export { isMultilineDocument, isPlainTextDocument } from './helpers/schema';
14
14
  export { createHTMLSerializer, getHTMLSerializerInstance } from './serializers/html/html';
15
+ export { remarkAutolinkLiteral } from './serializers/html/plugins/remark-autolink-literal';
16
+ export { remarkStrikethrough } from './serializers/html/plugins/remark-strikethrough';
15
17
  export { createMarkdownSerializer, getMarkdownSerializerInstance, } from './serializers/markdown/markdown';
16
18
  export { canInsertNodeAt } from './utilities/can-insert-node-at';
17
19
  export { canInsertSuggestion } from './utilities/can-insert-suggestion';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,WAAW,GACd,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,cAAc,kCAAkC,CAAA;AAChD,cAAc,uEAAuE,CAAA;AACrF,cAAc,oEAAoE,CAAA;AAClF,cAAc,0EAA0E,CAAA;AACxF,cAAc,6EAA6E,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AACrE,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,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAChF,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC9D,YAAY,EACR,sBAAsB,EACtB,iBAAiB,IAAI,uBAAuB,GAC/C,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA"}
package/dist/index.js CHANGED
@@ -9,6 +9,8 @@ export { RichTextKit } from './extensions/rich-text/rich-text-kit';
9
9
  export { createSuggestionExtension } from './factories/create-suggestion-extension';
10
10
  export { isMultilineDocument, isPlainTextDocument } from './helpers/schema';
11
11
  export { createHTMLSerializer, getHTMLSerializerInstance } from './serializers/html/html';
12
+ export { remarkAutolinkLiteral } from './serializers/html/plugins/remark-autolink-literal';
13
+ export { remarkStrikethrough } from './serializers/html/plugins/remark-strikethrough';
12
14
  export { createMarkdownSerializer, getMarkdownSerializerInstance, } from './serializers/markdown/markdown';
13
15
  export { canInsertNodeAt } from './utilities/can-insert-node-at';
14
16
  export { canInsertSuggestion } from './utilities/can-insert-suggestion';
@@ -107,7 +107,7 @@ function createHTMLSerializer(schema) {
107
107
  // Configure the unified processor with an official plugin that defines how to take a syntax
108
108
  // tree as input and turn it into serialized HTML
109
109
  unifiedProcessor.use(rehypeStringify, {
110
- entities: {
110
+ characterReferences: {
111
111
  // Compatibility with the previous implementation in Marked
112
112
  useNamedReferences: true,
113
113
  },
@@ -1 +1 @@
1
- {"version":3,"file":"rehype-code-block.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/rehype-code-block.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;GAKG;AACH,iBAAS,eAAe,IAAI,WAAW,CAiBtC;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
1
+ {"version":3,"file":"rehype-code-block.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/rehype-code-block.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C;;;;;GAKG;AACH,iBAAS,eAAe,IAAI,WAAW,CAiBtC;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
@@ -1,6 +1,5 @@
1
- import { isElement } from 'hast-util-is-element';
2
1
  import { visit } from 'unist-util-visit';
3
- import { isTextNode } from '../../../helpers/unified';
2
+ import { isHastElement, isHastTextNode } from '../../../helpers/unified';
4
3
  /**
5
4
  * A rehype plugin to remove the trailing newline from code blocks (i.e. the newline between the
6
5
  * last code line and `</code></pre>`). Although that newline is part of the CommonMark
@@ -10,9 +9,9 @@ import { isTextNode } from '../../../helpers/unified';
10
9
  function rehypeCodeBlock() {
11
10
  return (...[tree]) => {
12
11
  visit(tree, 'element', (node) => {
13
- if (isElement(node, 'pre') &&
14
- isElement(node.children[0], 'code') &&
15
- isTextNode(node.children[0].children[0])) {
12
+ if (isHastElement(node, 'pre') &&
13
+ isHastElement(node.children[0], 'code') &&
14
+ isHastTextNode(node.children[0].children[0])) {
16
15
  node.children[0].children[0].value = node.children[0].children[0].value.replace(/\n$/, '');
17
16
  }
18
17
  });
@@ -1 +1 @@
1
- {"version":3,"file":"rehype-image.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/rehype-image.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C;;;;;GAKG;AACH,iBAAS,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CA0BhD;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"rehype-image.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/rehype-image.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C;;;;;GAKG;AACH,iBAAS,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CA0BhD;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -1,6 +1,6 @@
1
- import { isElement } from 'hast-util-is-element';
2
1
  import { remove } from 'unist-util-remove';
3
2
  import { visit } from 'unist-util-visit';
3
+ import { isHastElement } from '../../../helpers/unified';
4
4
  /**
5
5
  * A rehype plugin to remove the wrapping paragraph from images and to remove all inline images if
6
6
  * the editor was configured without inline image support (Tiptap default).
@@ -15,8 +15,8 @@ function rehypeImage(schema) {
15
15
  }
16
16
  return (...[tree]) => {
17
17
  visit(tree, 'element', (node, index, parent) => {
18
- if (isElement(node, 'p')) {
19
- const areAllChildrenImages = node.children.every((c) => isElement(c, 'img'));
18
+ if (isHastElement(node, 'p')) {
19
+ const areAllChildrenImages = node.children.every((c) => isHastElement(c, 'img'));
20
20
  // Replace the paragraph with the image children if all children are images, or
21
21
  // remove all images from the paragraph if it contains non-image children since the
22
22
  // editor does not support inline images
@@ -24,7 +24,7 @@ function rehypeImage(schema) {
24
24
  parent.children.splice(index, 1, ...node.children);
25
25
  }
26
26
  else {
27
- remove(node, (n) => isElement(n, 'img'));
27
+ remove(node, (n) => isHastElement(n, 'img'));
28
28
  }
29
29
  }
30
30
  });
@@ -1 +1 @@
1
- {"version":3,"file":"rehype-suggestions.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/rehype-suggestions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;GAIG;AACH,iBAAS,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CA+BtD;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
1
+ {"version":3,"file":"rehype-suggestions.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/rehype-suggestions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C;;;;GAIG;AACH,iBAAS,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAkCtD;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,7 +1,6 @@
1
- import { isElement } from 'hast-util-is-element';
2
1
  import { visit } from 'unist-util-visit';
3
2
  import { buildSuggestionSchemaPartialRegex } from '../../../helpers/serializer';
4
- import { isTextNode } from '../../../helpers/unified';
3
+ import { isHastElement, isHastTextNode } from '../../../helpers/unified';
5
4
  /**
6
5
  * A rehype plugin to add support for suggestions nodes (e.g., `@username` or `#channel).
7
6
  *
@@ -16,10 +15,11 @@ function rehypeSuggestions(schema) {
16
15
  return (...[tree]) => {
17
16
  const suggestionSchemaRegex = new RegExp(`^${suggestionSchemaPartialRegex}`);
18
17
  visit(tree, 'element', (node) => {
19
- if (isElement(node, 'a') && suggestionSchemaRegex.test(String(node.properties?.href))) {
18
+ if (isHastElement(node, 'a') &&
19
+ suggestionSchemaRegex.test(String(node.properties?.href))) {
20
20
  const [, schema, id] = /^([a-z-]+):\/\/(\S+)$/i.exec(String(node.properties?.href)) || [];
21
21
  // Replace the link element with a span containing the suggestion attributes
22
- if (schema && id && isTextNode(node.children[0])) {
22
+ if (schema && id && isHastTextNode(node.children[0])) {
23
23
  node.tagName = 'span';
24
24
  node.properties = {
25
25
  [`data-${schema}`]: '',
@@ -1 +1 @@
1
- {"version":3,"file":"rehype-task-list.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/rehype-task-list.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;GAEG;AACH,iBAAS,cAAc,IAAI,WAAW,CAoCrC;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
1
+ {"version":3,"file":"rehype-task-list.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/rehype-task-list.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C;;GAEG;AACH,iBAAS,cAAc,IAAI,WAAW,CAoCrC;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -1,15 +1,14 @@
1
- import { isElement } from 'hast-util-is-element';
2
1
  import { visit } from 'unist-util-visit';
3
- import { isTextNode } from '../../../helpers/unified';
2
+ import { isHastElement, isHastTextNode } from '../../../helpers/unified';
4
3
  /**
5
4
  * A rehype plugin to add support for Tiptap task lists (i.e., `* [ ] Task`).
6
5
  */
7
6
  function rehypeTaskList() {
8
7
  return (...[tree]) => {
9
8
  visit(tree, 'element', (node) => {
10
- if (isElement(node, 'ul')) {
11
- const areAllChildrenTaskItems = node.children.every((c) => isElement(c, 'li') &&
12
- isTextNode(c.children[0]) &&
9
+ if (isHastElement(node, 'ul')) {
10
+ const areAllChildrenTaskItems = node.children.every((c) => isHastElement(c, 'li') &&
11
+ isHastTextNode(c.children[0]) &&
13
12
  /^\[[ x]\] /i.test(c.children[0].value));
14
13
  // Add the required attributes to the list and list items if all children are tasks,
15
14
  // removing the `[ ] ` or `[x] ` at the beginning of the task item text
@@ -19,7 +18,7 @@ function rehypeTaskList() {
19
18
  'data-type': 'taskList',
20
19
  };
21
20
  node.children.forEach((c) => {
22
- if (isElement(c, 'li') && isTextNode(c.children[0])) {
21
+ if (isHastElement(c, 'li') && isHastTextNode(c.children[0])) {
23
22
  c.properties = {
24
23
  ...c.properties,
25
24
  'data-type': 'taskItem',
@@ -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,QAY7C;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
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"}
@@ -15,12 +15,11 @@ import { gfmAutolinkLiteral } from 'micromark-extension-gfm-autolink-literal';
15
15
  */
16
16
  function remarkAutolinkLiteral() {
17
17
  const data = this.data();
18
- function add(field, value) {
19
- const list = (data[field] ? data[field] : (data[field] = []));
20
- list.push(value);
21
- }
22
- add('micromarkExtensions', gfmAutolinkLiteral);
23
- add('fromMarkdownExtensions', gfmAutolinkLiteralFromMarkdown);
24
- add('toMarkdownExtensions', gfmAutolinkLiteralToMarkdown);
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());
25
24
  }
26
25
  export { remarkAutolinkLiteral };
@@ -1 +1 @@
1
- {"version":3,"file":"remark-disable-constructs.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/remark-disable-constructs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC;;;;;GAKG;AACH,iBAAS,uBAAuB,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAqD/D;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAA"}
1
+ {"version":3,"file":"remark-disable-constructs.d.ts","sourceRoot":"","sources":["../../../../src/serializers/html/plugins/remark-disable-constructs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC;;;;;GAKG;AACH,iBAAS,uBAAuB,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAiD/D;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAA"}
@@ -6,10 +6,6 @@
6
6
  */
7
7
  function remarkDisableConstructs(schema) {
8
8
  const data = this.data();
9
- function add(field, value) {
10
- const list = (data[field] ? data[field] : (data[field] = []));
11
- list.push(value);
12
- }
13
9
  const disabledConstructs = [];
14
10
  if (!schema.nodes.blockquote) {
15
11
  disabledConstructs.push('blockQuote');
@@ -38,8 +34,9 @@ function remarkDisableConstructs(schema) {
38
34
  if (!schema.marks.link) {
39
35
  disabledConstructs.push('labelStartLink');
40
36
  }
37
+ const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
41
38
  // https://github.com/micromark/micromark#case-turn-off-constructs
42
- add('micromarkExtensions', {
39
+ micromarkExtensions.push({
43
40
  disable: {
44
41
  null: disabledConstructs,
45
42
  },
@@ -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,QAYlE;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
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"}
@@ -15,12 +15,11 @@ import { gfmStrikethrough } from 'micromark-extension-gfm-strikethrough';
15
15
  */
16
16
  function remarkStrikethrough(options = {}) {
17
17
  const data = this.data();
18
- function add(field, value) {
19
- const list = (data[field] ? data[field] : (data[field] = []));
20
- list.push(value);
21
- }
22
- add('micromarkExtensions', gfmStrikethrough(options));
23
- add('fromMarkdownExtensions', gfmStrikethroughFromMarkdown);
24
- add('toMarkdownExtensions', gfmStrikethroughToMarkdown);
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());
25
24
  }
26
25
  export { remarkStrikethrough };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@doist/typist",
3
3
  "description": "The mighty Tiptap-based rich-text editor React component that powers Doist products.",
4
- "version": "2.3.1",
4
+ "version": "4.0.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://typist.doist.dev/",
7
7
  "repository": "https://github.com/Doist/typist",
@@ -82,27 +82,29 @@
82
82
  "devDependencies": {
83
83
  "@doist/eslint-config": "11.0.0",
84
84
  "@doist/prettier-config": "4.0.0",
85
- "@doist/reactist": "22.3.3",
85
+ "@doist/reactist": "23.1.0",
86
86
  "@mdx-js/react": "3.0.0",
87
- "@rollup/rollup-linux-x64-gnu": "4.9.5",
87
+ "@rollup/rollup-linux-x64-gnu": "4.9.6",
88
88
  "@semantic-release/changelog": "6.0.3",
89
89
  "@semantic-release/exec": "6.0.3",
90
90
  "@semantic-release/git": "10.0.1",
91
- "@storybook/addon-a11y": "7.6.8",
92
- "@storybook/addon-essentials": "7.6.8",
93
- "@storybook/addons": "7.6.8",
91
+ "@storybook/addon-a11y": "7.6.10",
92
+ "@storybook/addon-essentials": "7.6.10",
93
+ "@storybook/addons": "7.6.10",
94
94
  "@storybook/csf": "0.1.2",
95
95
  "@storybook/mdx2-csf": "1.1.0",
96
- "@storybook/react": "7.6.8",
97
- "@storybook/react-vite": "7.6.8",
96
+ "@storybook/react": "7.6.10",
97
+ "@storybook/react-vite": "7.6.10",
98
98
  "@testing-library/dom": "9.3.4",
99
- "@testing-library/jest-dom": "6.2.0",
99
+ "@testing-library/jest-dom": "6.3.0",
100
100
  "@testing-library/react": "14.1.2",
101
+ "@types/hast": "3.0.3",
101
102
  "@types/lodash-es": "4.17.12",
102
- "@types/react": "18.2.47",
103
+ "@types/react": "18.2.48",
103
104
  "@types/react-dom": "18.2.18",
104
105
  "@types/react-syntax-highlighter": "15.5.11",
105
106
  "@types/turndown": "5.0.4",
107
+ "@types/unist": "3.0.2",
106
108
  "@vitejs/plugin-react": "4.2.1",
107
109
  "boring-avatars": "1.10.1",
108
110
  "classnames": "2.5.1",
@@ -123,21 +125,23 @@
123
125
  "jsdom": "23.2.0",
124
126
  "lint-staged": "15.2.0",
125
127
  "npm-run-all": "4.1.5",
126
- "prettier": "3.2.1",
128
+ "prettier": "3.2.4",
127
129
  "react": "18.2.0",
128
130
  "react-dom": "18.2.0",
129
131
  "react-icons": "5.0.1",
130
- "react-markdown": "8.0.7",
132
+ "react-markdown": "9.0.1",
131
133
  "react-syntax-highlighter": "15.5.0",
134
+ "rehype-raw": "7.0.0",
135
+ "remark-gfm": "4.0.0",
132
136
  "rimraf": "5.0.5",
133
- "semantic-release": "22.0.12",
137
+ "semantic-release": "23.0.0",
134
138
  "tippy.js": "6.3.7",
135
- "storybook": "7.6.8",
139
+ "storybook": "7.6.10",
136
140
  "storybook-css-modules": "1.0.8",
137
- "type-fest": "4.9.0",
141
+ "type-fest": "4.10.1",
138
142
  "typescript": "5.3.3",
139
143
  "typescript-plugin-css-modules": "5.0.2",
140
- "vitest": "1.2.0"
144
+ "vitest": "1.2.1"
141
145
  },
142
146
  "peerDependencies": {
143
147
  "@react-hookz/web": "^14.2.3 || >=15.x",
@@ -145,24 +149,25 @@
145
149
  "hast-util-is-element": "^2.1.0",
146
150
  "linkifyjs": "^4.1.1",
147
151
  "lodash-es": "^4.17.21",
148
- "mdast-util-gfm-autolink-literal": "^1.0.0",
149
- "mdast-util-gfm-strikethrough": "^1.0.0",
150
- "micromark-extension-gfm-autolink-literal": "^1.0.0",
151
- "micromark-extension-gfm-strikethrough": "^1.0.0",
152
+ "mdast-util-gfm-autolink-literal": "^2.0.0",
153
+ "mdast-util-gfm-strikethrough": "^2.0.0",
154
+ "micromark-extension-gfm-autolink-literal": "^2.0.0",
155
+ "micromark-extension-gfm-strikethrough": "^2.0.0",
152
156
  "react": "^17.0.0 || ^18.0.0",
153
157
  "react-dom": "^17.0.0 || ^18.0.0",
154
- "rehype": "^12.0.0",
155
- "rehype-minify-whitespace": "^5.0.0",
156
- "rehype-raw": "^6.1.0",
157
- "rehype-stringify": "^9.0.0",
158
- "remark": "^14.0.0",
159
- "remark-breaks": "^3.0.0",
160
- "remark-gfm": "^3.0.0",
161
- "remark-rehype": "^10.1.0",
158
+ "rehype": "^13.0.0",
159
+ "rehype-minify-whitespace": "^6.0.0",
160
+ "rehype-raw": "^7.0.0",
161
+ "rehype-stringify": "^10.0.0",
162
+ "remark": "^15.0.0",
163
+ "remark-breaks": "^4.0.0",
164
+ "remark-gfm": "^4.0.0",
165
+ "remark-parse": "^11.0.0",
166
+ "remark-rehype": "^11.0.0",
162
167
  "turndown": "^7.1.0",
163
- "unified": "^10.1.0",
164
- "unist-util-is": "^5.2.0",
168
+ "unified": "^11.0.0",
169
+ "unist-util-is": "^6.0.0",
165
170
  "unist-util-remove": "^4.0.0",
166
- "unist-util-visit": "^4.1.0"
171
+ "unist-util-visit": "^5.0.0"
167
172
  }
168
173
  }