From 8448118d31e3aade0f52d76f87731275c8d2a452 Mon Sep 17 00:00:00 2001 From: Jonathon Suggs Date: Fri, 4 Jan 2013 11:38:44 -0600 Subject: [PATCH] Add a setting for the maxTextLen --- prettyprint.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prettyprint.js b/prettyprint.js index 38e2b67..a575ff2 100644 --- a/prettyprint.js +++ b/prettyprint.js @@ -180,9 +180,8 @@ var prettyPrint = (function(){ }, shorten: function(str) { - var max = 40; str = str.replace(/^\s\s*|\s\s*$|\n/g,''); - return str.length > max ? (str.substring(0, max-1) + '...') : str; + return str.length > prettyPrint.settings.maxTextLen ? (str.substring(0, prettyPrint.settings.maxTextLen-1) + '...') : str; }, htmlentities: function(str) { @@ -684,6 +683,7 @@ var prettyPrint = (function(){ forceObject: false, maxDepth: 3, maxArray: -1, // default is unlimited + maxTextLen: 40, styles: { array: { th: {