Skip to content
Browse files

[api] Handle italics

  • Loading branch information...
1 parent 53a18cf commit 66628a7f26e6f1a1ba9785a78b839643058381e3 @mmalecki committed Nov 27, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/ansispan.js
View
5 lib/ansispan.js
@@ -19,6 +19,11 @@ var ansispan = function (str) {
//
str = str.replace(/\033\[1m/g, '<b>').replace(/\033\[22m/g, '</b>');
+ //
+ // `\033[3m` enables italics font, `\033[23m` disables it
+ //
+ str = str.replace(/\033\[3m/g, '<i>').replace(/\033\[23m/g, '</i>');
+
return str.replace(/\033\[39m/g, '</span>');
};

0 comments on commit 66628a7

Please sign in to comment.
Something went wrong with that request. Please try again.