From 65899fe106bedcb160d59f23323eaffe6d7e975c Mon Sep 17 00:00:00 2001
From: tatsy <tatsy.mail@gmail.com>
Date: Thu, 2 Apr 2015 13:04:05 +0900
Subject: [PATCH] Support relative size specification like (=100%x).

---
 lib/helpers/parse_image_size.js             | 2 +-
 test/fixtures/markdown-it-imsize/imsize.txt | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/helpers/parse_image_size.js b/lib/helpers/parse_image_size.js
index 16e3f02..3a913ff 100644
--- a/lib/helpers/parse_image_size.js
+++ b/lib/helpers/parse_image_size.js
@@ -13,7 +13,7 @@ function parseNextNumber(str, pos, max) {
 
   code = str.charCodeAt(pos);
 
-  while (pos < max && (code >= 0x30 /* 0 */ && code <= 0x39 /* 9 */)) {
+  while (pos < max && (code >= 0x30 /* 0 */ && code <= 0x39 /* 9 */) || code === 0x25 /* % */) {
     code = str.charCodeAt(++pos);
   }
 
diff --git a/test/fixtures/markdown-it-imsize/imsize.txt b/test/fixtures/markdown-it-imsize/imsize.txt
index ff83718..95c429b 100644
--- a/test/fixtures/markdown-it-imsize/imsize.txt
+++ b/test/fixtures/markdown-it-imsize/imsize.txt
@@ -278,6 +278,11 @@ Coverage. Image
 .
 <p><img src="x" alt="test" width="100" height="200"></p>
 .
+.
+![test](test =100%x)
+.
+<p><img src="test" alt="test" width="100%"></p>
+.
 
 Coverage. Link
 .
-- 
GitLab