-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
ENH: styler.render.repr
option
#43180
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
f917726
add to docs
attack68 0d459ef
add to docs
attack68 46d933b
Merge remote-tracking branch 'upstream/master' into styler_latex_repr
attack68 0a00907
Merge remote-tracking branch 'upstream/master' into styler_latex_repr
attack68 983d6f4
add test
attack68 32343bc
Merge remote-tracking branch 'upstream/master' into styler_latex_repr
attack68 e298e0a
whats new
attack68 42808a0
Merge remote-tracking branch 'upstream/master' into styler_latex_repr
attack68 64f2b50
Merge remote-tracking branch 'upstream/master' into styler_latex_repr
attack68 5ddf521
add _latex_repr_
attack68 a598e54
Merge remote-tracking branch 'upstream/master' into styler_latex_repr
attack68 0951a49
Merge remote-tracking branch 'upstream/master' into styler_latex_repr
attack68 d865a9f
Merge remote-tracking branch 'upstream/master' into styler_latex_repr
attack68 4cae9ac
refactor
attack68 90f9a17
Merge remote-tracking branch 'upstream/master' into styler_latex_repr
attack68 e2129a1
Merge remote-tracking branch 'upstream/master' into styler_latex_repr
attack68 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,9 +233,17 @@ def __init__( | |
|
||
def _repr_html_(self) -> str: | ||
""" | ||
Hooks into Jupyter notebook rich display system. | ||
Hooks into Jupyter notebook rich display system, which calls _repr_html_ by | ||
default if an object is returned at the end of a cell. | ||
""" | ||
return self.to_html() | ||
if get_option("styler.render.repr") == "html": | ||
return self.to_html() | ||
return None | ||
|
||
def _repr_latex_(self) -> str: | ||
if get_option("styler.render.repr") == "latex": | ||
return self.to_latex() | ||
return None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @attack68 i think this is causing the mypy failures on CI There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will take a look |
||
|
||
def render( | ||
self, | ||
|
@@ -927,7 +935,7 @@ def to_html( | |
``class`` and ``id`` identifiers, or solely the ``<table>`` element without | ||
styling identifiers. | ||
**kwargs | ||
Any additional keyword arguments are passed through to the jinj2 | ||
Any additional keyword arguments are passed through to the jinja2 | ||
``self.template.render`` process. This is useful when you need to provide | ||
additional variables for a custom template. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
IIRC aren't we supposed to have a
_repr_latex_
?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 don't know. See if you prefer the new pattern, simple change.