@@ -1610,7 +1610,13 @@ async function mdFromCodeCell(
1610
1610
if ( output . output_type === "stream" ) {
1611
1611
const stream = output as JupyterOutputStream ;
1612
1612
if ( asis && stream . name === "stdout" ) {
1613
- md . push ( stream . text . join ( "" ) ) ;
1613
+ let text : string [ ] = [ ] ;
1614
+ if ( typeof stream . text === "string" ) {
1615
+ text = [ stream . text ] ;
1616
+ } else {
1617
+ text = stream . text ;
1618
+ }
1619
+ md . push ( text . join ( "" ) ) ;
1614
1620
} else {
1615
1621
md . push ( mdOutputStream ( stream ) ) ;
1616
1622
}
@@ -1750,21 +1756,28 @@ function isMarkdown(output: JupyterOutput, options: JupyterToMarkdownOptions) {
1750
1756
}
1751
1757
1752
1758
function mdOutputStream ( output : JupyterOutputStream ) {
1759
+ let text : string [ ] = [ ] ;
1760
+ if ( typeof output . text === "string" ) {
1761
+ text = [ output . text ] ;
1762
+ } else {
1763
+ text = output . text ;
1764
+ }
1765
+
1753
1766
// trim off warning source line for notebook
1754
1767
if ( output . name === "stderr" ) {
1755
- if ( output . text [ 0 ] ) {
1756
- const firstLine = output . text [ 0 ] . replace (
1768
+ if ( text [ 0 ] ) {
1769
+ const firstLine = text [ 0 ] . replace (
1757
1770
/ < i p y t h o n - i n p u t .* ?> : \d + : \s + / ,
1758
1771
"" ,
1759
1772
) ;
1760
1773
return mdCodeOutput (
1761
- [ firstLine , ...output . text . slice ( 1 ) ] . map ( colors . stripColor ) ,
1774
+ [ firstLine , ...text . slice ( 1 ) ] . map ( colors . stripColor ) ,
1762
1775
) ;
1763
1776
}
1764
1777
}
1765
1778
1766
1779
// normal default handling
1767
- return mdCodeOutput ( output . text . map ( colors . stripColor ) ) ;
1780
+ return mdCodeOutput ( text . map ( colors . stripColor ) ) ;
1768
1781
}
1769
1782
1770
1783
async function mdOutputError (
0 commit comments