瀏覽代碼

fix(strikethrough): Fix strikethrough issue with escaped chars

Closes #214
Estevão Soares dos Santos 9 年之前
父節點
當前提交
5669317fe4

+ 2 - 2
dist/showdown.js

@@ -1,4 +1,4 @@
-;/*! showdown 19-10-2015 */
+;/*! showdown 30-10-2015 */
 (function(){
 /**
  * Created by Tivie on 13-07-2015.
@@ -2210,7 +2210,7 @@ showdown.subParser('strikethrough', function (text, options, globals) {
 
   if (options.strikethrough) {
     text = globals.converter._dispatch('strikethrough.before', text, options);
-    text = text.replace(/(?:~T){2}([^~]+)(?:~T){2}/g, '<del>$1</del>');
+    text = text.replace(/(?:~T){2}([\s\S]+?)(?:~T){2}/g, '<del>$1</del>');
     text = globals.converter._dispatch('strikethrough.after', text, options);
   }
 

文件差異過大導致無法顯示
+ 0 - 0
dist/showdown.js.map


文件差異過大導致無法顯示
+ 1 - 1
dist/showdown.min.js


文件差異過大導致無法顯示
+ 0 - 0
dist/showdown.min.js.map


+ 1 - 1
src/subParsers/strikethrough.js

@@ -3,7 +3,7 @@ showdown.subParser('strikethrough', function (text, options, globals) {
 
   if (options.strikethrough) {
     text = globals.converter._dispatch('strikethrough.before', text, options);
-    text = text.replace(/(?:~T){2}([^~]+)(?:~T){2}/g, '<del>$1</del>');
+    text = text.replace(/(?:~T){2}([\s\S]+?)(?:~T){2}/g, '<del>$1</del>');
     text = globals.converter._dispatch('strikethrough.after', text, options);
   }
 

+ 1 - 0
test/features/#214.escaped-markdown-chars-break-strikethrough.html

@@ -0,0 +1 @@
+<p>Your friend <del><a href="www.google.com"><strong>test*</strong></a></del> (<del><a href="www.google.com"><em>@test</em></a></del>) updated his/her description</p>

+ 1 - 0
test/features/#214.escaped-markdown-chars-break-strikethrough.md

@@ -0,0 +1 @@
+Your friend ~~[**test\***](www.google.com)~~ (~~[*@test*](www.google.com)~~) updated his/her description

+ 1 - 1
test/node/testsuite.features.js

@@ -19,7 +19,7 @@ describe('makeHtml() features testsuite', function () {
       converter = new showdown.Converter({simplifiedAutoLink: true});
     } else if (testsuite[i].name === '#164.2.disallow-underscore-emphasis-mid-word') {
       converter = new showdown.Converter({literalMidWordUnderscores: true});
-    } else if (testsuite[i].name === '#164.3.strikethrough') {
+    } else if (testsuite[i].name === '#164.3.strikethrough' || testsuite[i].name === '#214.escaped-markdown-chars-break-strikethrough') {
       converter = new showdown.Converter({strikethrough: true});
     } else if (testsuite[i].name === 'disable-gh-codeblocks') {
       converter = new showdown.Converter({ghCodeBlocks: false});

部分文件因文件數量過多而無法顯示