File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
notebook/static/notebook/js Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -701,7 +701,16 @@ define([
701
701
var text_and_math = mathjaxutils . remove_math ( markdown ) ;
702
702
var text = text_and_math [ 0 ] ;
703
703
var math = text_and_math [ 1 ] ;
704
- marked ( text , function ( err , html ) {
704
+ // Prevent marked from returning inline styles for table cells
705
+ var renderer = new marked . Renderer ( ) ;
706
+ renderer . tablecell = function ( content , flags ) {
707
+ var type = flags . header ? 'th' : 'td' ;
708
+ var start_tag = '<' + type + '>' ;
709
+ var end_tag = '</' + type + '>\n' ;
710
+ return start_tag + content + end_tag ;
711
+ } ;
712
+ marked ( text , { renderer : renderer } , function ( err , html ) {
713
+ // marked(text, function (err, html) {
705
714
html = mathjaxutils . replace_math ( html , math ) ;
706
715
toinsert . append ( html ) ;
707
716
} ) ;
Original file line number Diff line number Diff line change @@ -391,7 +391,16 @@ define([
391
391
var text_and_math = mathjaxutils . remove_math ( text ) ;
392
392
text = text_and_math [ 0 ] ;
393
393
math = text_and_math [ 1 ] ;
394
- marked ( text , function ( err , html ) {
394
+ // Prevent marked from returning inline styles for table cells
395
+ var renderer = new marked . Renderer ( ) ;
396
+ renderer . tablecell = function ( content , flags ) {
397
+ var type = flags . header ? 'th' : 'td' ;
398
+ var start_tag = '<' + type + '>' ;
399
+ var end_tag = '</' + type + '>\n' ;
400
+ return start_tag + content + end_tag ;
401
+ } ;
402
+ marked ( text , { renderer : renderer } , function ( err , html ) {
403
+ // marked(text, function (err, html) {
395
404
html = mathjaxutils . replace_math ( html , math ) ;
396
405
html = security . sanitize_html ( html ) ;
397
406
html = $ ( $ . parseHTML ( html ) ) ;
You can’t perform that action at this time.
0 commit comments