Created
May 5, 2011 23:16
-
-
Save Twipped/958175 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _DoItalicsAndBold = function (text) { | |
// <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>"); | |
return text; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment