nb2mail icon indicating copy to clipboard operation
nb2mail copied to clipboard

Multiline text loses line breaks

Open noe opened this issue 2 years ago • 1 comments

In notebooks that print multiple lines of text in the output of a cell, the conversion generates a single <p> element with all the text. However, by default newlines are not shown by <p> unless it has style white-space: pre-wrap, therefore, the resulting HTML page lacks the line breaks.

This problem does not happen when invoking nbconvert with --to html. There, the output is converted to a <pre> element.

I tried to find the cause in the code, but I am not familiar with the internals of nbconvert, so I couldn't find anything. Can you help? Thanks.

noe avatar Jan 11 '24 19:01 noe

After digging a bit more, I have seen that there is a template and that changing the block output to have <pre> instead of <p> fixes my issue. I don't know if this may cause undesired effects.

In case such a modification is not deemed appropriate, I have seen that it's possible to specify the template for nbconvert (with --template), so I can address this problem without any modification to nb2mail.

noe avatar Jan 11 '24 20:01 noe