fastai / fastdoc

Create publication-quality books from Jupyter notebooks
https://fastai.github.io/fastdoc/
Apache License 2.0
231 stars 30 forks source link

Text wrapping causes misinterpretation #15

Open AllenDowney opened 3 years ago

AllenDowney commented 3 years ago

In the source notebook I have the following bullet item:

* The host, Monty Hall, shows you three closed doors numbered 1, 2, and 3. He tells you that there is a prize behind each door.

After fastdoc converts to asciidoc, it looks like this:

* The host, Monty Hall, shows you three closed doors numbered 1, 2, and
3. He tells you that there is a prize behind each door.

Because the second line begins with 3., it gets interpreted as a numbered list item.

Is text wrapping necessary? Can it be turned off?

Or should I edit the text so the line break falls in a different place :)

Thanks!

maxpumperla commented 3 years ago

@AllenDowney, I think you can adapt this line (in the corresponding jupyter notebook generating this script):

https://github.com/fastai/fastdoc/blob/master/fastdoc/asciidoc.py#L162

to either output['text'] = '\\n'.join(lines) or output['text'] = '+\n'.join(lines), since I believe asciidoctor supports both + and the probably better \ for line continuations. I'm not sure why the wrapping functionality is there in the first place, since most good editors soft-wrap lines, but maybe @jph00 can speak to that (hi! btw).

In any case, you can either remove the wrapping functionality altogether locally, or use my fix above (untested). I can also create a PR for this if it works for you.

AllenDowney commented 3 years ago

@maxpumperla Thanks very much!

jph00 commented 3 years ago

@maxpumperla I believe that wrapping is just for cell outputs. Without it, plain text outputs will go off the right-hand edge of the page if they're long.

It would be helpful if one of you could show a reproducible example that I could look at.