-
-
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
Fix markdown table rendering issue with inline styles/links #3130
Conversation
The table data elements were not interacting well with inline styles (in the rich sense) and the table data element would have its content overridden every time we found another excerpt of text with a different style.
7195db4
to
e30b822
Compare
plain = text.plain if isinstance(text, Text) else text | ||
style = text.style if isinstance(text, Text) else "" | ||
self.content = Text( | ||
plain, justify=self.justify, style=context.style_stack.current | ||
) | ||
text = Text(text) if isinstance(text, str) else text | ||
text.stylize(context.current_style) | ||
self.content.append_text(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a bit confused here because style
was being created but not used.
My change will preserve whatever styling is already in the Text
instance but will then add the current context style on top of it.
This felt like the correct thing to do.
FWIW: I pip installed your pull request branch into my original project where I spotted the issue that only a single/ the last link remained in a markdown table cell and I'm happy to report that this change fixes the problem for me 👍 🥳 |
That's good to know! |
Type of changes
Checklist
Description
The table data elements were not interacting well with inline styles (in the rich sense) and the table data element would have its content overridden every time we found another excerpt of text with a different style.
The fix was to do something similar to what
TextElement
does in its methodon_text
, which is to append the new content instead of replacing it.This fixes #3115.