Textualize/rich

[BUG] Using markdown and console pager does not render the markdown with styles

Opened this issue · 4 comments

  • [X ] I've checked docs and closed issues for possible solutions.
  • [X ] I can't find my issue in the FAQ.

Describe the bug

Im trying to use markdown with the console pager.
Witout the pager, the rendering is correct. headings, numberd items, code etc.
When the pager is enabled most of the rendering is plain

markdown= '''
# Heading 1
## Heading 2

1. pointA
2. pointB

`im code `
'''

a = 1

if a == 1:
      md= Markdown(markdown)
      console  = Console()
      console.print(md)

if a == 2:
      md= Markdown(markdown)
      console  = Console()
      with console.pager():
         console.print(md)

Output when a =1
image

Output when a =2

  • heading 1 is rendered.
  • heading2 , numbered items and code not rendered.

image

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

Did you check the pager docs (last paragraph)? https://rich.readthedocs.io/en/latest/console.html?#paging

I tried this and it generated an exception
with console.pager(styles=True, pager='less -R'):

MANPAGER and PAGER are environment variables as mentioned in the docs. If you need a quick overview of environment variables, I'd recommend checking out this video: https://www.youtube.com/watch?v=h36Xc38SDHg

For example, here's how you could use the env utility to set MANPAGER when running your code:

env MANPAGER="less -r" python3 my_script.py