Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coseeing/see-mark",
"version": "1.4.1",
"version": "1.4.2",
"description": "A markdown parser for a11y",
"main": "./lib/see-mark.cjs",
"files": [
Expand Down
6 changes: 3 additions & 3 deletions src/markdown-processor/markdown-processor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ describe('markdownProcessor', () => {
alt: 'alt text',
imageId: 'image-123',
position: { start: 0, end: 52 },
src: 'https://example.com/image.jpg',
source: 'https://example.com/image.jpg',
target: 'https://example.com/target',
});
});
Expand Down Expand Up @@ -346,7 +346,7 @@ describe('markdownProcessor', () => {
display: 'Display caption',
imageId: 'image-456',
position: { start: 0, end: 41 },
src: 'https://example.com/image2.jpg',
source: 'https://example.com/image2.jpg',
});
});

Expand Down Expand Up @@ -382,7 +382,7 @@ describe('markdownProcessor', () => {
display: 'Display caption',
imageId: 'image-789',
position: { start: 0, end: 72 },
src: 'https://example.com/image3.jpg',
source: 'https://example.com/image3.jpg',
target: 'https://example.com/details',
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const markedImageDisplayLink = ({ imageFiles, shouldBuildImageObjectURL }) => {

try {
const imageFile = imageFiles[imageId];
const src = shouldBuildImageObjectURL
const source = shouldBuildImageObjectURL
? blobUrlManager(imageId, imageFile)
: imageFile;

Expand All @@ -81,7 +81,7 @@ const markedImageDisplayLink = ({ imageFiles, shouldBuildImageObjectURL }) => {
alt,
display,
imageId,
src,
source,
target,
},
};
Expand All @@ -99,7 +99,7 @@ const markedImageDisplayLink = ({ imageFiles, shouldBuildImageObjectURL }) => {
alt,
display,
imageId,
src: imageId,
source: imageId,
target,
},
};
Expand Down
6 changes: 3 additions & 3 deletions src/markdown-processor/marked-extentions/image-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const markedImageDisplay = ({ imageFiles, shouldBuildImageObjectURL }) => {

try {
const imageFile = imageFiles[imageId];
const src = shouldBuildImageObjectURL
const source = shouldBuildImageObjectURL
? blobUrlManager(imageId, imageFile)
: imageFile;

Expand All @@ -74,7 +74,7 @@ const markedImageDisplay = ({ imageFiles, shouldBuildImageObjectURL }) => {
alt,
display,
imageId,
src,
source,
},
};
} catch (error) {
Expand All @@ -90,7 +90,7 @@ const markedImageDisplay = ({ imageFiles, shouldBuildImageObjectURL }) => {
alt,
display,
imageId,
src: imageId,
source: imageId,
},
};
}
Expand Down
6 changes: 3 additions & 3 deletions src/markdown-processor/marked-extentions/image-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const markedImageLink = ({ imageFiles, shouldBuildImageObjectURL }) => {

try {
const imageFile = imageFiles[imageId];
const src = shouldBuildImageObjectURL
const source = shouldBuildImageObjectURL
? blobUrlManager(imageId, imageFile)
: imageFile;

Expand All @@ -73,7 +73,7 @@ const markedImageLink = ({ imageFiles, shouldBuildImageObjectURL }) => {
meta: {
alt,
imageId,
src,
source,
target,
},
};
Expand All @@ -89,7 +89,7 @@ const markedImageLink = ({ imageFiles, shouldBuildImageObjectURL }) => {
meta: {
alt,
imageId,
src: imageId,
source: imageId,
target,
},
};
Expand Down
6 changes: 3 additions & 3 deletions src/markdown-processor/marked-extentions/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ const markedImage = ({ imageFiles, shouldBuildImageObjectURL }) => {
const imageId = token.href;
const imageFile = imageFiles[imageId];

const src = shouldBuildImageObjectURL
const source = shouldBuildImageObjectURL
? blobUrlManager(imageId, imageFile)
: imageFile;

return { alt, imageId, src };
return { alt, imageId, source };
},
parseChildren: false,
onError(error, token) {
console.error('Error processing image:', error);
return {
alt: token.text,
imageId: token.href,
src: token.href,
source: token.href,
};
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const ImageDisplayLink = ({
alt = '',
display = '',
imageId = '',
src = '',
source = '',
target = '',
}) => {
return (
<a href={target}>
<figure>
<img src={src} alt={alt} data-seemark-image-id={imageId} />
<img src={source} alt={alt} data-seemark-image-id={imageId} />
<figcaption>{display}</figcaption>
</figure>
</a>
Expand All @@ -22,7 +22,7 @@ ImageDisplayLink.propTypes = {
alt: PropTypes.string,
display: PropTypes.string,
imageId: PropTypes.string,
src: PropTypes.string,
source: PropTypes.string,
target: PropTypes.string.isRequired,
position: PropTypes.shape({ start: PropTypes.number, end: PropTypes.number }),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React from 'react';
import PropTypes from 'prop-types';

const ImageDisplay = ({ alt = '', display = '', imageId = '', src = '' }) => {
const ImageDisplay = ({
alt = '',
display = '',
imageId = '',
source = '',
}) => {
return (
<figure>
<img src={src} alt={alt} data-seemark-image-id={imageId} />
<img src={source} alt={alt} data-seemark-image-id={imageId} />
<figcaption>{display}</figcaption>
</figure>
);
Expand All @@ -14,7 +19,7 @@ ImageDisplay.propTypes = {
alt: PropTypes.string,
display: PropTypes.string,
imageId: PropTypes.string,
src: PropTypes.string,
source: PropTypes.string,
position: PropTypes.shape({ start: PropTypes.number, end: PropTypes.number }),
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import PropTypes from 'prop-types';

const ImageLink = ({ alt = '', imageId = '', src = '', target = '' }) => {
const ImageLink = ({ alt = '', imageId = '', source = '', target = '' }) => {
return (
<a href={target}>
<img src={src} alt={alt} data-seemark-image-id={imageId} />
<img src={source} alt={alt} data-seemark-image-id={imageId} />
</a>
);
};

ImageLink.propTypes = {
alt: PropTypes.string,
imageId: PropTypes.string,
src: PropTypes.string,
source: PropTypes.string,
target: PropTypes.string.isRequired,
position: PropTypes.shape({ start: PropTypes.number, end: PropTypes.number }),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import PropTypes from 'prop-types';

const Image = ({ alt = '', imageId = '', src = '' }) => {
return <img src={src} alt={alt} data-seemark-image-id={imageId} />;
const Image = ({ alt = '', imageId = '', source = '' }) => {
return <img src={source} alt={alt} data-seemark-image-id={imageId} />;
};

Image.propTypes = {
alt: PropTypes.string,
imageId: PropTypes.string,
src: PropTypes.string,
source: PropTypes.string,
position: PropTypes.shape({ start: PropTypes.number, end: PropTypes.number }),
};

Expand Down