-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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] Rich markdown printed to console only shows a single link in a column/ table cell #3115
Comments
Could you post the Markdown it generates? |
|
I actually discovered that the problem is that if there is a link in a table, only the link (and in case of multiple links the last one) is rendered. For instance: from rich.console import Console
from rich.markdown import Markdown
import pandas as pd
md_table = pd.DataFrame(
{
"links": ["some text [page1](https://www.example.com/page1 )"]
}
).to_markdown()
console = Console()
console.print(Markdown(md_table)) will result in: links
━━━━━━━━━━━
0 page1 Thus, swallowing "some text" that was also present in this table cell. Not sure if this gives a clue about what might be wrong? |
This may also be present in Textual. |
If I'm reading the issue correctly, it seems to be working fine in Textual (as seen via Frogmouth): viewing this Markdown: | One | Two | Three |
|------------------------------------------------------------|-----------|---------------------------------------|
| Some test [and then a link](https://textualize.io/) | Just Text | [Just a link](https://textualize.io/) |
| Text [then a link](https://blog.davep.org/) then more text | Just Text | Some final text | |
Good to know. We must be doing something different in Rich. |
Oh nice. Wondering: Can I use |
You can certainly use Textual, but it works differently from |
Consider this markdown file: [page 1](https://mathspp.com)
| links |
| - |
| asdfasdf [page 1](https://mathspp.com) | Running
Putting text on the right of the table link makes the link go away and only displays that text: file.md with text on the right.[page 1](https://mathspp.com)
| links |
| - |
| asdfasdf [page 1](https://mathspp.com) right | Output of
|
Turns out we're seeing this interesting interaction with a bunch of inline styles in markdown. The markdown below gets rendered into the output shown after that: | stuff |
| - |
| asdfasdf [page 1](https://mathspp.com) some text |
| This is `some code` here |
| This is `some code` |
| Can I set this to _italics_? |
|
I've tracked the issue down to |
I hope we solved your problem. If you like using Rich, you might also enjoy Textual |
Describe the bug
I use Rich to format a pandas data frame with multiple links in some column to markdown and show it in the terminal. However, when there are more than a single link in a column rich only shows the last one?
Output:
Expected
If I write the markdown to a file I get the expected table with multiple links...
Platform
platform="Darwin"
rich==13.5.2
The text was updated successfully, but these errors were encountered: