Permalink
Browse files

[api] Handle bold strings

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

0 comments on commit f2d60ea

Please sign in to comment.