File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed
Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -1110,15 +1110,10 @@ async function mdFromCodeCell(
11101110 }
11111111
11121112 // filter matplotlib intermediate vars
1113- if ( output . output_type === "execute_result" ) {
1114- const textPlain = ( output as JupyterOutputDisplayData ) . data
1115- ?. [ kTextPlain ] as string [ ] | undefined ;
1116- if (
1117- textPlain && textPlain . length && textPlain [ 0 ] . startsWith ( "[<matplotlib" )
1118- ) {
1119- return false ;
1120- }
1113+ if ( isDiscadableTextExecuteResult ( output ) ) {
1114+ return false ;
11211115 }
1116+
11221117 return true ;
11231118 } ) . map ( ( output ) => {
11241119 // convert text/latex math to markdown as appropriate
@@ -1514,6 +1509,21 @@ async function mdFromCodeCell(
15141509 return md ;
15151510}
15161511
1512+ function isDiscadableTextExecuteResult ( output : JupyterOutput ) {
1513+ if ( output . output_type === "execute_result" ) {
1514+ const textPlain = ( output as JupyterOutputDisplayData ) . data
1515+ ?. [ kTextPlain ] as string [ ] | undefined ;
1516+ if ( textPlain && textPlain . length ) {
1517+ return [
1518+ "[<matplotlib" ,
1519+ "<seaborn." ,
1520+ "<ggplot:" ,
1521+ ] . some ( ( startsWith ) => textPlain [ 0 ] . startsWith ( startsWith ) ) ;
1522+ }
1523+ }
1524+ return false ;
1525+ }
1526+
15171527function hasLayoutOptions ( cell : JupyterCellWithOptions ) {
15181528 return Object . keys ( cell . options ) . some ( ( key ) => key . startsWith ( "layout" ) ) ;
15191529}
You can’t perform that action at this time.
0 commit comments