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

Display SVG images in the table #225

Closed
mojaie opened this issue Nov 11, 2023 · 4 comments
Closed

Display SVG images in the table #225

mojaie opened this issue Nov 11, 2023 · 4 comments

Comments

@mojaie
Copy link

mojaie commented Nov 11, 2023

Thank you very much for your great effort for maintaining this library.

I'm working on displaying DataFrames with SVG images in Jupyter.
DataFrames seems not allow HTML inside cell, and I found a workaround of using markdown cells. Is this a intended behavior?

スクリーンショット 2023-11-11 10 19 07
@mojaie
Copy link
Author

mojaie commented Nov 12, 2023

Perhaps this is more straightforward but but I wonder what the line break at the end is
スクリーンショット 2023-11-12 9 51 46

@ronisbr
Copy link
Owner

ronisbr commented Nov 13, 2023

Hi @mojaie !

DataFrames seems not allow HTML inside cell, and I found a workaround of using markdown cells. Is this an intended behavior?

Yes, it is! The purpose is to avoid breaking the table with HTML tags. Hence, we escape everything unless you explicitly say you want those tags. You have two options. The first is the one you found by setting allow_html_in_cells, the other is to wrap the cell content into a HtmlCell as stated here: https://ronisbr.github.io/PrettyTables.jl/stable/man/html_backend/

Perhaps this is more straightforward but but I wonder what the line break at the end is

I have no ideia. Something is adding a break-line character when rendering the content. Can you please pass the option linebreaks = true?

@mojaie
Copy link
Author

mojaie commented Nov 16, 2023

linebreaks = true did not work because my HTML code have SVG inside.

スクリーンショット 2023-11-16 14 52 39

HtmlCell also produced the same output as shown in the allow_html_in_cells example above.
I found the HTML content have SVG and trailing \n inside <div> so this would be escaped.

Anyway, markdown seems to work very well.

@ronisbr
Copy link
Owner

ronisbr commented Nov 16, 2023

Ok! Thanks!

@ronisbr ronisbr closed this as completed Nov 16, 2023
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

2 participants