diff --git a/src/showdown.js b/src/showdown.js
index b488bad..f08a326 100644
--- a/src/showdown.js
+++ b/src/showdown.js
@@ -508,6 +508,9 @@ var _RunSpanGamut = function(text) {
// Do hard breaks:
text = text.replace(/ +\n/g,"
\n");
+ // Un-escape the escaped underscores now that italics are done
+ text = text.replace(/\%5F/g, '_')
+
return text;
}
@@ -1278,6 +1281,9 @@ var _DoAutoLinks = function(text) {
text = text.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,"$1");
+ // Escape the underscores in text links temporarily
+ text = text.replace(/_/g,"%5F")
+
// Email addresses: