Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown text wrapping cuts off #66

Open
jjeffrey opened this issue Aug 28, 2022 · 3 comments
Open

Markdown text wrapping cuts off #66

jjeffrey opened this issue Aug 28, 2022 · 3 comments

Comments

@jjeffrey
Copy link

When editing a Markdown cell inside nbterm, I can insert line breaks so that the content fits on screen.
image

However, when viewing a Markdown cell, text wrapping always cuts off a portion of the text, as long as it overflows. This is independent of the width of the terminal emulator: resizing it does not help.

image

On a related note, Markdown headers, which are center-aligned, are often cut off as well.
image

Using Gnome Terminal on Ubuntu 22.04, and Python 3.10.4.

@davidbrochart
Copy link
Owner

Thanks for reporting @jjeffrey.
nbterm relies on Rich for markdown rendering. I don't know if it's possible to configure it so that it wraps text.
Do you want to look at it and open a PR? That would be great.

@jjeffrey
Copy link
Author

It does seem that euporie, which appears to also use Textualize/rich, has more accurate text wrapping on rendered Markdown cells.

Screenshot from euporie:
image

I'm not sure if I'm the best person to look into it, but if I end up tinkering around and figuring out my problem, I'll try to make a PR.

@joouha
Copy link

joouha commented Aug 31, 2022

I used rich to render markdown in euporie prior to v1.4.0, but I now use my own renderer based on markdown-it-py (so I can support tables, LaTeX, images, etc. in markdown).

To get rich to wrap the markdown, you'll need to set the max_width on the rich Console when rendering the output here. You can see how this was done in euporie here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants