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

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

Open
derekwallace opened this issue Nov 2, 2024 · 4 comments

Comments

@derekwallace
Copy link

  • [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

Copy link

github-actions bot commented Nov 2, 2024

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

@TomJGooding
Copy link
Contributor

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

@derekwallace
Copy link
Author

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

@TomJGooding
Copy link
Contributor

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

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

No branches or pull requests

2 participants