diff --git a/cypress/e2e/4.image-rendering/image-rendering.cy.js b/cypress/e2e/4.image-rendering/image-rendering.cy.js
new file mode 100644
index 00000000..e25e6b54
--- /dev/null
+++ b/cypress/e2e/4.image-rendering/image-rendering.cy.js
@@ -0,0 +1,43 @@
+///
+
+describe('Image rendering', () => {
+
+ const imageUrl = 'https://picsum.photos/id/237/150';
+
+ beforeEach(() => {
+ cy.visit(__dirname + '/index.html');
+ cy.intercept('GET', imageUrl).as('image');
+ });
+
+ it('must render an image inside the editor', () => {
+ cy.get('.EasyMDEContainer').should('be.visible');
+ cy.get('#textarea').should('not.be.visible');
+
+ cy.get('.EasyMDEContainer .CodeMirror').type(imageUrl);
+ cy.get('.EasyMDEContainer .CodeMirror').type('{home}');
+
+ cy.wait('@image');
+
+ cy.get(`.EasyMDEContainer [data-img-src="${imageUrl}"]`).should('be.visible');
+
+ cy.previewOn();
+
+ cy.get('.EasyMDEContainer .editor-preview').should('contain.html', `

`);
+ });
+
+ it('must be able to handle parentheses inside image alt text', () => {
+ cy.get('.EasyMDEContainer').should('be.visible');
+ cy.get('#textarea').should('not.be.visible');
+
+ cy.get('.EasyMDEContainer .CodeMirror').type(imageUrl);
+ cy.get('.EasyMDEContainer .CodeMirror').type('{home}');
+
+ cy.wait('@image');
+
+ cy.get(`.EasyMDEContainer [data-img-src="${imageUrl}"]`).should('be.visible');
+
+ cy.previewOn();
+
+ cy.get('.EasyMDEContainer .editor-preview').should('contain.html', `
`);
+ });
+});
diff --git a/cypress/e2e/4.image-rendering/index.html b/cypress/e2e/4.image-rendering/index.html
new file mode 100644
index 00000000..045bc339
--- /dev/null
+++ b/cypress/e2e/4.image-rendering/index.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+ Default
+
+
+
+
+
+
+
+
+
+
diff --git a/src/js/easymde.js b/src/js/easymde.js
index c038d1c7..449c76fd 100644
--- a/src/js/easymde.js
+++ b/src/js/easymde.js
@@ -2251,7 +2251,7 @@ EasyMDE.prototype.render = function (el) {
return;
}
if (!parentEl.hasAttribute('data-img-src')) {
- var srcAttr = parentEl.innerText.match('\\((.*)\\)'); // might require better parsing according to markdown spec
+ var srcAttr = parentEl.innerText.match(/!\[.*?\]\((.*?)\)/); // might require better parsing according to markdown spec
if (!window.EMDEimagesCache) {
window.EMDEimagesCache = {};
}