# Text wrapping in Notebook

**URL:** <https://discourse.jupyter.org/t/text-wrapping-in-notebook/24228>\
**Category:** ipynb\
**Tags:** how-to, help-wanted\
**Created:** [March 2, 2024, 7:06am UTC](https://discourse.jupyter.org/t/text-wrapping-in-notebook/24228 "2024-03-02T07:06:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [March 2, 2024, 4:45pm UTC](https://discourse.jupyter.org/t/text-wrapping-in-notebook/24228/2 "2024-03-02T16:45:54Z")

</div>

I’m missing the context here? You first just mention using Jupyter Notebook (and presumably your title) and then are talking saving it as PDF. Those are two vastly different things. Where do you really need wrapping of code here?

Do you just need to view it ‘statically’ after-the-fact so the code isn’t cut off? (Like PDF) Then use nbviewer. See [here](https://discourse.jupyter.org/t/display-cell-scrollbar-in-jupyter-notebook-on-github/12534/4) for more about that with links to examples. If the content needs to be private you can use nbpreview, see more explanation about that [at the top here](https://stackoverflow.com/a/71094775/8508004).

A lot of these questions arise because there’s a lot of way to work in Jupyter with a lot of languages. Are you using Python? Then you can use black in conjunction with your notebook. You can just write and let it format later. This way your code is more portable in the end. See for example [nbQA](https://github.com/nbQA-dev/nbQA). Or see how with Jupytext you can pipe your notebook code to black [here](https://towardsdatascience.com/jupytext-1-0-highlights-a49dca9baa7b).

There’s lot of other options that make it hard to understand exactly what you seek at this point:

Code cell wrapping in Notebook help:

- [Adding word-wrap to code cells in Jupyter Notebooks causes only 1st 11 lines of code to be visible until one clicks inside the cell · Issue #5303 · jupyter/notebook · GitHub](https://github.com/jupyter/notebook/issues/5303)

Code cell wrapping for Jupyter Notebook use in VSCode hlep:

- [python - How to wrap code/text in Jupyter notebooks - Stack Overflow](https://stackoverflow.com/a/71234369/8508004)
- [How can I set up Jupyter Notebook to wrap text in all cells? - #2 by V-Talbot](https://discourse.jupyter.org/t/how-can-i-set-up-jupyter-notebook-to-wrap-text-in-all-cells/3935/2)

Wrapping in JupyterLab help:

- [Cannot enable line wrap for raw cells in jupyter lab 4.0.8 - Stack Overflow](https://stackoverflow.com/a/77523294/8508004)
- [No line wrapping in notebook code cells · Issue #15579 · jupyterlab/jupyterlab · GitHub](https://github.com/jupyterlab/jupyterlab/issues/15579)

---

_[View the full topic](https://discourse.jupyter.org/t/text-wrapping-in-notebook/24228)._
