1

I have made a project that displays markdown in the terminal. I have used pygments library in python for rendering formatted output.

lexer = MarkdownLexer()
formatter = TerminalFormatter()
highlighted = highlight(body_markdown, lexer, formatted)

The highlighted text is printed in in the console.

The problem is that the text is not wrapping around the edges of the terminal as can be screen from the image below.

Image Link

The text runs off the screen. What can I do to fix this? I would prefer to use pygments library only as it is compatible with simple-term-menu. I am displaying text in the preview panel of Terminal Menu create with simple-term-menu library.

0 Answers0