File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
src/jupyter_contrib_nbextensions/nbextensions/limit_output Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ Parameters:
24
24
description : Enable limiting display_data messages
25
25
input_type : checkbox
26
26
default : false
27
+ - name : limit_html_output
28
+ description : Enable limiting HTML outputs
29
+ input_type : checkbox
30
+ default : false
27
31
- name : limit_output_message
28
32
description : Message to append when output is limited
29
33
input_type : text
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ define([
18
18
limit_stream : true ,
19
19
limit_execute_result : true ,
20
20
limit_display_data : false ,
21
+ limit_html_output : false ,
21
22
// message to print when output is limited
22
23
limit_output_message : '<b>limit_output extension: Maximum message size of {limit_output_length} exceeded with {output_length} characters</b>'
23
24
} ;
@@ -49,6 +50,14 @@ define([
49
50
return old_handle_output . apply ( this , arguments ) ;
50
51
}
51
52
else {
53
+ // HTML contents can not be simply truncated
54
+ // that would result unclosed tags, corrupted HTML
55
+ if (
56
+ ! params . limit_html_output &&
57
+ msg . content . data [ 'text/html' ] !== undefined
58
+ ) {
59
+ return old_handle_output . apply ( this , arguments ) ;
60
+ }
52
61
// get MAX_CHARACTERS from cell metadata if present, otherwise param
53
62
//msg.header.msg_type
54
63
var MAX_CHARACTERS = params . limit_output ;
You can’t perform that action at this time.
0 commit comments