react-native-marked 5.0.7 → 5.0.8

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.
@@ -10,10 +10,13 @@ const getValidURL = (prefix, path) => {
10
10
 
11
11
  if (_prefix.endsWith("/")) {
12
12
  _prefix = _prefix.slice(0, -1);
13
- } // path is valid url
13
+ } // consider path a valid url if it starts with a scheme name followed by a semicolon
14
+ // i.e. https://example.com, mailto:person@example.com, tel:1234567, slack://open
14
15
 
15
16
 
16
- if (path.startsWith("https") || path.startsWith("http")) {
17
+ const urlPattern = /^[a-z]+:/i;
18
+
19
+ if (urlPattern.test(path)) {
17
20
  return path;
18
21
  } // absolute path
19
22
 
@@ -1 +1 @@
1
- {"version":3,"names":["getValidURL","prefix","path","_prefix","endsWith","slice","startsWith"],"sourceRoot":"../../../src","sources":["utils/url.ts"],"mappings":";;;;;;;AAAO,MAAMA,WAAW,GAAG,CAACC,MAAD,EAAiBC,IAAjB,KAAkC;EAC5D,IAAIC,OAAO,GAAGF,MAAd,CAD4D,CAE5D;;EACA,IAAIE,OAAO,CAACC,QAAR,CAAiB,GAAjB,CAAJ,EAA2B;IAC1BD,OAAO,GAAGA,OAAO,CAACE,KAAR,CAAc,CAAd,EAAiB,CAAC,CAAlB,CAAV;EACA,CAL2D,CAO5D;;;EACA,IAAIH,IAAI,CAACI,UAAL,CAAgB,OAAhB,KAA4BJ,IAAI,CAACI,UAAL,CAAgB,MAAhB,CAAhC,EAAyD;IACxD,OAAOJ,IAAP;EACA,CAV2D,CAY5D;;;EACA,IAAIA,IAAI,CAACI,UAAL,CAAgB,GAAhB,CAAJ,EAA0B;IACzB,OAAQ,GAAEH,OAAQ,GAAED,IAAK,EAAzB;EACA,CAf2D,CAiB5D;;;EACA,OAAQ,GAAEC,OAAQ,IAAGD,IAAK,EAA1B;AACA,CAnBM"}
1
+ {"version":3,"names":["getValidURL","prefix","path","_prefix","endsWith","slice","urlPattern","test","startsWith"],"sourceRoot":"../../../src","sources":["utils/url.ts"],"mappings":";;;;;;;AAAO,MAAMA,WAAW,GAAG,CAACC,MAAD,EAAiBC,IAAjB,KAAkC;EAC5D,IAAIC,OAAO,GAAGF,MAAd,CAD4D,CAE5D;;EACA,IAAIE,OAAO,CAACC,QAAR,CAAiB,GAAjB,CAAJ,EAA2B;IAC1BD,OAAO,GAAGA,OAAO,CAACE,KAAR,CAAc,CAAd,EAAiB,CAAC,CAAlB,CAAV;EACA,CAL2D,CAO5D;EACA;;;EACA,MAAMC,UAAU,GAAG,WAAnB;;EACA,IAAIA,UAAU,CAACC,IAAX,CAAgBL,IAAhB,CAAJ,EAA2B;IAC1B,OAAOA,IAAP;EACA,CAZ2D,CAc5D;;;EACA,IAAIA,IAAI,CAACM,UAAL,CAAgB,GAAhB,CAAJ,EAA0B;IACzB,OAAQ,GAAEL,OAAQ,GAAED,IAAK,EAAzB;EACA,CAjB2D,CAmB5D;;;EACA,OAAQ,GAAEC,OAAQ,IAAGD,IAAK,EAA1B;AACA,CArBM"}
@@ -3,10 +3,13 @@ export const getValidURL = (prefix, path) => {
3
3
 
4
4
  if (_prefix.endsWith("/")) {
5
5
  _prefix = _prefix.slice(0, -1);
6
- } // path is valid url
6
+ } // consider path a valid url if it starts with a scheme name followed by a semicolon
7
+ // i.e. https://example.com, mailto:person@example.com, tel:1234567, slack://open
7
8
 
8
9
 
9
- if (path.startsWith("https") || path.startsWith("http")) {
10
+ const urlPattern = /^[a-z]+:/i;
11
+
12
+ if (urlPattern.test(path)) {
10
13
  return path;
11
14
  } // absolute path
12
15
 
@@ -1 +1 @@
1
- {"version":3,"names":["getValidURL","prefix","path","_prefix","endsWith","slice","startsWith"],"sourceRoot":"../../../src","sources":["utils/url.ts"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG,CAACC,MAAD,EAAiBC,IAAjB,KAAkC;EAC5D,IAAIC,OAAO,GAAGF,MAAd,CAD4D,CAE5D;;EACA,IAAIE,OAAO,CAACC,QAAR,CAAiB,GAAjB,CAAJ,EAA2B;IAC1BD,OAAO,GAAGA,OAAO,CAACE,KAAR,CAAc,CAAd,EAAiB,CAAC,CAAlB,CAAV;EACA,CAL2D,CAO5D;;;EACA,IAAIH,IAAI,CAACI,UAAL,CAAgB,OAAhB,KAA4BJ,IAAI,CAACI,UAAL,CAAgB,MAAhB,CAAhC,EAAyD;IACxD,OAAOJ,IAAP;EACA,CAV2D,CAY5D;;;EACA,IAAIA,IAAI,CAACI,UAAL,CAAgB,GAAhB,CAAJ,EAA0B;IACzB,OAAQ,GAAEH,OAAQ,GAAED,IAAK,EAAzB;EACA,CAf2D,CAiB5D;;;EACA,OAAQ,GAAEC,OAAQ,IAAGD,IAAK,EAA1B;AACA,CAnBM"}
1
+ {"version":3,"names":["getValidURL","prefix","path","_prefix","endsWith","slice","urlPattern","test","startsWith"],"sourceRoot":"../../../src","sources":["utils/url.ts"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG,CAACC,MAAD,EAAiBC,IAAjB,KAAkC;EAC5D,IAAIC,OAAO,GAAGF,MAAd,CAD4D,CAE5D;;EACA,IAAIE,OAAO,CAACC,QAAR,CAAiB,GAAjB,CAAJ,EAA2B;IAC1BD,OAAO,GAAGA,OAAO,CAACE,KAAR,CAAc,CAAd,EAAiB,CAAC,CAAlB,CAAV;EACA,CAL2D,CAO5D;EACA;;;EACA,MAAMC,UAAU,GAAG,WAAnB;;EACA,IAAIA,UAAU,CAACC,IAAX,CAAgBL,IAAhB,CAAJ,EAA2B;IAC1B,OAAOA,IAAP;EACA,CAZ2D,CAc5D;;;EACA,IAAIA,IAAI,CAACM,UAAL,CAAgB,GAAhB,CAAJ,EAA0B;IACzB,OAAQ,GAAEL,OAAQ,GAAED,IAAK,EAAzB;EACA,CAjB2D,CAmB5D;;;EACA,OAAQ,GAAEC,OAAQ,IAAGD,IAAK,EAA1B;AACA,CArBM"}
@@ -1 +1 @@
1
- {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/utils/url.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,WAAY,MAAM,QAAQ,MAAM,WAmBvD,CAAC"}
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/utils/url.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,WAAY,MAAM,QAAQ,MAAM,WAqBvD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-marked",
3
- "version": "5.0.7",
3
+ "version": "5.0.8",
4
4
  "description": "Markdown renderer for React Native powered by marked.js",
5
5
  "main": "dist/commonjs/index",
6
6
  "module": "dist/module/index",
@@ -51,20 +51,20 @@
51
51
  "devDependencies": {
52
52
  "@babel/core": "7.22.9",
53
53
  "@babel/preset-env": "7.22.9",
54
- "@commitlint/config-conventional": "17.6.6",
55
- "@evilmartians/lefthook": "1.4.5",
54
+ "@commitlint/config-conventional": "17.6.7",
55
+ "@evilmartians/lefthook": "1.4.7",
56
56
  "@release-it/conventional-changelog": "7.0.0",
57
57
  "@testing-library/jest-native": "5.4.2",
58
- "@testing-library/react-native": "12.1.2",
58
+ "@testing-library/react-native": "12.1.3",
59
59
  "@types/jest": "29.5.3",
60
60
  "@types/marked": "5.0.0",
61
- "@types/node": "18.16.19",
62
- "@types/react": "18.2.15",
61
+ "@types/node": "18.17.1",
62
+ "@types/react": "18.2.16",
63
63
  "@types/react-native": "0.72.2",
64
64
  "@types/react-native-table-component": "1.2.4",
65
65
  "@types/svg-parser": "^2.0.3",
66
- "commitlint": "17.6.6",
67
- "danger": "11.2.6",
66
+ "commitlint": "17.6.7",
67
+ "danger": "11.2.7",
68
68
  "jest": "29.6.1",
69
69
  "jest-environment-jsdom": "29.6.1",
70
70
  "metro-react-native-babel-preset": "0.77.0",
@@ -72,10 +72,10 @@
72
72
  "postinstall-postinstall": "2.1.0",
73
73
  "react": "18.2.0",
74
74
  "react-native": "0.72.3",
75
- "react-native-builder-bob": "0.21.2",
75
+ "react-native-builder-bob": "0.21.3",
76
76
  "react-test-renderer": "18.2.0",
77
77
  "reassure": "0.9.1",
78
- "release-it": "16.1.2",
78
+ "release-it": "16.1.3",
79
79
  "rome": "12.1.3",
80
80
  "typescript": "5.1.6"
81
81
  },
@@ -169,7 +169,7 @@
169
169
  "node": ">=18"
170
170
  },
171
171
  "resolutions": {
172
- "@types/react": "18.2.15",
172
+ "@types/react": "18.2.16",
173
173
  "@types/react-native": "0.72.2"
174
174
  }
175
175
  }
package/src/utils/url.ts CHANGED
@@ -5,8 +5,10 @@ export const getValidURL = (prefix: string, path: string) => {
5
5
  _prefix = _prefix.slice(0, -1);
6
6
  }
7
7
 
8
- // path is valid url
9
- if (path.startsWith("https") || path.startsWith("http")) {
8
+ // consider path a valid url if it starts with a scheme name followed by a semicolon
9
+ // i.e. https://example.com, mailto:person@example.com, tel:1234567, slack://open
10
+ const urlPattern = /^[a-z]+:/i;
11
+ if (urlPattern.test(path)) {
10
12
  return path;
11
13
  }
12
14