Skip to content

Commit 742e407

Browse files
committed
Fix regexp and only allows specifying width with 'x'
1 parent b88f6ec commit 742e407

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

docs/platforms/apple/common/user-feedback/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The User Feedback feature allows you to collect user feedback from anywhere insi
1919

2020
The User Feedback widget allows users to submit feedback from anywhere inside your application.
2121

22-
![An example of the User Feedback Widget on iOS =300x](./img/user-feedback-apple-widget.png)
22+
![An example of the User Feedback Widget on iOS =350x](./img/user-feedback-apple-widget.png)
2323

2424
### Pre-requisites
2525

src/remark-image-resize.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {visit} from 'unist-util-visit';
22

3-
const SIZE_FROM_ALT_RE = /\s*=\s*(\d+)?x?(\d+)?\s*$/;
3+
const SIZE_FROM_ALT_RE = /\s*=\s*(?:(\d+)\s*x\s*(\d+)|(\d+)\s*x|x\s*(\d+))\s*$/;
44
/**
55
* remark plugin to parse width/height hints from the image ALT text.
66
*
@@ -30,7 +30,9 @@ export default function remarkImageResize() {
3030
if (altValue) {
3131
const sizeMatch = altValue.match(SIZE_FROM_ALT_RE);
3232
if (sizeMatch) {
33-
const [, wStr, hStr] = sizeMatch;
33+
const [, wBoth, hBoth, wOnlyWithX, hOnlyWithX] = sizeMatch;
34+
const wStr = wBoth || wOnlyWithX || undefined;
35+
const hStr = hBoth || hOnlyWithX || undefined;
3436
const cleanedAlt = altValue.replace(SIZE_FROM_ALT_RE, '').trim();
3537
// set cleaned alt
3638
node.attributes[altIndex] = {

0 commit comments

Comments
 (0)