diff --git a/lib/helpers/parse_image_size.js b/lib/helpers/parse_image_size.js index 16e3f028a8af32062e7eddce54bb75de99297e05..3a913ff8e385f651f052a373768e1506ad970499 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 ff83718a5e6c1a5a9b11535f84f24223d2d5ba1c..95c429b8c41101d4847b9d5bb933ed1cf4af7ffa 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> . +. + +. +<p><img src="test" alt="test" width="100%"></p> +. Coverage. Link .