Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Markdown Extension: Underscores are no longer interchangeable with as…

…terisks for denoting italics and bold, but instead denote underlined text.

Example: _this text is underlined_
  • Loading branch information...
commit dc2957228f4ef2d8627bfac8b05e9e3ddfb1288c 1 parent 4c6a93f
@ChiperSoft authored
Showing with 11 additions and 4 deletions.
  1. +11 −4 showdown.js
View
15 showdown.js
@@ -978,11 +978,18 @@ Showdown.converter = function () {
var _DoItalicsAndBold = function (text) {
- // <strong> must go first:
- text = text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g, "<strong>$2</strong>");
+ if (true) { //eventually this will be replaced with a runtime option. But for now we're forcing it.
+ text = text.replace(/(\*\*)(?=\S)([^\r]*?\S[*]*)\1/g, "<strong>$2</strong>");
+ text = text.replace(/(\w)_(\w)/g, "$1~E95E$2"); // ** GFM ** "~E95E" == escaped "_"
+ text = text.replace(/(\*)(?=\S)([^\r]*?\S)\1/g, "<em>$2</em>");
+ text = text.replace(/(_)(?=\S)([^\r]*?\S)\1/g, "<u>$2</u>");
+ } else {
+ // <strong> must go first:
+ text = text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g, "<strong>$2</strong>");
- text = text.replace(/(\w)_(\w)/g, "$1~E95E$2"); // ** GFM ** "~E95E" == escaped "_"
- text = text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g, "<em>$2</em>");
+ text = text.replace(/(\w)_(\w)/g, "$1~E95E$2"); // ** GFM ** "~E95E" == escaped "_"
+ text = text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g, "<em>$2</em>");
+ }
return text;
};
Please sign in to comment.
Something went wrong with that request. Please try again.