@doist/typist 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [1.3.1](https://github.com/Doist/typist/compare/v1.3.0...v1.3.1) (2023-06-13)
2
+
3
+ ### Bug Fixes
4
+
5
+ - Add support for literal autolinks (GFM based) ([#303](https://github.com/Doist/typist/issues/303)) ([4537091](https://github.com/Doist/typist/commit/45370914988eed1226722051f18a2fa49d9aa50f))
6
+
1
7
  ## [1.3.0](https://github.com/Doist/typist/compare/v1.2.9...v1.3.0) (2023-06-12)
2
8
 
3
9
  ### Features
@@ -1 +1 @@
1
- {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/serializers/html/html.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C;;GAEG;AACH,KAAK,wBAAwB,GAAG;IAC5B;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;CAC1C,CAAA;AA0CD;;;;;;;;GAQG;AACH,iBAAS,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,wBAAwB,CA2EtE;AAOD;;;;;;GAMG;AACH,iBAAS,yBAAyB,CAAC,MAAM,EAAE,MAAM,4BAQhD;AAED,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,CAAA;AAE1D,YAAY,EAAE,wBAAwB,EAAE,CAAA"}
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/serializers/html/html.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C;;GAEG;AACH,KAAK,wBAAwB,GAAG;IAC5B;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;CAC1C,CAAA;AA0CD;;;;;;;;GAQG;AACH,iBAAS,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,wBAAwB,CAiFtE;AAOD;;;;;;GAMG;AACH,iBAAS,yBAAyB,CAAC,MAAM,EAAE,MAAM,4BAQhD;AAED,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,CAAA;AAE1D,YAAY,EAAE,wBAAwB,EAAE,CAAA"}
@@ -10,6 +10,7 @@ import { rehypeCodeBlock } from './plugins/rehype-code-block';
10
10
  import { rehypeImage } from './plugins/rehype-image';
11
11
  import { rehypeSuggestions } from './plugins/rehype-suggestions';
12
12
  import { rehypeTaskList } from './plugins/rehype-task-list';
13
+ import { remarkAutolinkLiteral } from './plugins/remark-autolink-literal';
13
14
  import { remarkDisableConstructs } from './plugins/remark-disable-constructs';
14
15
  import { remarkStrikethrough } from './plugins/remark-strikethrough';
15
16
  /**
@@ -68,6 +69,11 @@ function createHTMLSerializer(schema) {
68
69
  if (schema.marks.strike) {
69
70
  unifiedProcessor.use(remarkStrikethrough);
70
71
  }
72
+ // Configure the unified processor to use a custom plugin to add support for the autolink
73
+ // literals extension from the GitHub Flavored Markdown (GFM) specification
74
+ if (schema.marks.link) {
75
+ unifiedProcessor.use(remarkAutolinkLiteral);
76
+ }
71
77
  // Configure the unified processor with an official plugin to convert Markdown into HTML to
72
78
  // support rehype (a tool that transforms HTML with plugins), followed by another official
73
79
  // plugin to minify whitespace between tags (prevents line feeds from appearing as blank)
@@ -0,0 +1,17 @@
1
+ import type { Processor } from 'unified';
2
+ /**
3
+ * A remark plugin to add support for the autolink literals extension extension from the GitHub
4
+ * Flavored Markdown (GFM) specification.
5
+ *
6
+ * This is an standalone plugin which makes use of both the `mdast-util-gfm-autolink-literal` and
7
+ * `micromark-extension-gfm-autolink-literal` packages, and the implementation is inspired by the
8
+ * third-party `remark-gfm` plugin.
9
+ *
10
+ * The reason why we don't use `remark-gfm` directly is because we don't want to support all other
11
+ * GFM features (footnotes, tables, tagfilter, and tasklists).
12
+ *
13
+ * @param options Configuration options for the plugin.
14
+ */
15
+ declare function remarkAutolinkLiteral(this: Processor): void;
16
+ export { remarkAutolinkLiteral };
17
+ //# sourceMappingURL=remark-autolink-literal.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,26 @@
1
+ import { gfmAutolinkLiteralFromMarkdown, gfmAutolinkLiteralToMarkdown, } from 'mdast-util-gfm-autolink-literal';
2
+ import { gfmAutolinkLiteral } from 'micromark-extension-gfm-autolink-literal';
3
+ /**
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
+ */
16
+ function remarkAutolinkLiteral() {
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);
25
+ }
26
+ export { remarkAutolinkLiteral };
@@ -9,7 +9,7 @@ import type { Processor } from 'unified';
9
9
  * third-party `remark-gfm` plugin.
10
10
  *
11
11
  * The reason why we don't use `remark-gfm` directly is because we don't want to support all other
12
- * GFM features (autolink literals, footnotes, tables, and tasklists).
12
+ * GFM features (footnotes, tables, tagfilter, and tasklists).
13
13
  *
14
14
  * @param options Configuration options for the plugin.
15
15
  */
@@ -9,7 +9,7 @@ import { gfmStrikethrough } from 'micromark-extension-gfm-strikethrough';
9
9
  * third-party `remark-gfm` plugin.
10
10
  *
11
11
  * The reason why we don't use `remark-gfm` directly is because we don't want to support all other
12
- * GFM features (autolink literals, footnotes, tables, and tasklists).
12
+ * GFM features (footnotes, tables, tagfilter, and tasklists).
13
13
  *
14
14
  * @param options Configuration options for the plugin.
15
15
  */
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": "1.3.0",
4
+ "version": "1.3.1",
5
5
  "license": "MIT",
6
6
  "homepage": "https://typist.doist.dev/",
7
7
  "repository": "https://github.com/Doist/typist",
@@ -14,8 +14,7 @@
14
14
  "npm": "^7.0.0 || ^8.0.0 || ^9.0.0"
15
15
  },
16
16
  "publishConfig": {
17
- "access": "public",
18
- "provenance": true
17
+ "access": "public"
19
18
  },
20
19
  "files": [
21
20
  "CHANGELOG.md",
@@ -98,11 +97,11 @@
98
97
  "@testing-library/react": "14.0.0",
99
98
  "@types/hast": "2.3.4",
100
99
  "@types/lodash-es": "4.17.7",
101
- "@types/react": "18.2.8",
100
+ "@types/react": "18.2.9",
102
101
  "@types/react-dom": "18.2.4",
103
102
  "@types/react-syntax-highlighter": "15.5.7",
104
103
  "@types/turndown": "5.0.1",
105
- "boring-avatars": "1.7.0",
104
+ "boring-avatars": "1.10.0",
106
105
  "classnames": "2.3.2",
107
106
  "conventional-changelog-conventionalcommits": "6.0.0",
108
107
  "emoji-regex": "10.2.1",
@@ -134,14 +133,16 @@
134
133
  "type-fest": "3.11.1",
135
134
  "typescript": "5.1.3",
136
135
  "typescript-plugin-css-modules": "5.0.1",
137
- "vitest": "0.31.4"
136
+ "vitest": "0.32.0"
138
137
  },
139
138
  "peerDependencies": {
140
139
  "@react-hookz/web": "^14.2.3 || >=15.x",
141
140
  "emoji-regex": "^10.2.1",
142
141
  "hast-util-is-element": "^2.1.0",
143
142
  "lodash-es": "^4.17.21",
143
+ "mdast-util-gfm-autolink-literal": "^1.0.0",
144
144
  "mdast-util-gfm-strikethrough": "^1.0.0",
145
+ "micromark-extension-gfm-autolink-literal": "^1.0.0",
145
146
  "micromark-extension-gfm-strikethrough": "^1.0.0",
146
147
  "react": "^17.0.0 || ^18.0.0",
147
148
  "react-dom": "^17.0.0 || ^18.0.0",