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
Html and Evcxr integration #101
Conversation
Codecov Report
@@ Coverage Diff @@
## master #101 +/- ##
=========================================
+ Coverage 84.11% 85.6% +1.49%
=========================================
Files 5 5
Lines 1177 1327 +150
=========================================
+ Hits 990 1136 +146
- Misses 187 191 +4
Continue to review full report at Codecov.
|
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.
Hi ! Sorry for late reply, I've been qui busy past months. This looks good to me, but may I ask you to drop a few lines in the readme about this feature ?
Thanks
* Add a HTML escaper to the utils class. * Expand TableSlice, Row, and Cell with HTML printing functions. These are implemented from scratch as they share almost nothing with the line based printing used for text, as HTML directly supports multiline cells. * Add tests to Cell and Table which test the new functionality.
* Add optional feature for Evcxr integration * Implement trait for everything which can be converted into a Tableslice. The trait prints the Tableslice in plain-text and HTML format in a Evcxr compatible manner.
@phsym I updated the readme as well. I hope you are fine with embedding the picture into the readme. If not, feel free to edit this PR appropriately. |
This PR provides integration with Evcxr in two steps. If you do not know Evcxr, it is a Rust REPL and Jupyter kernel.
The first commit provides HTML output implementations for Cell, Row, and TableSlice. I tried to support all the styling features available. If I missed some, I can fix that.
The second commit provides optional integration with Evcxr via a off by default feature. Evcxr can display any type which has a
evcxr_display()
. The output must be formatted a certain way, e.g., theEVCXR_BEGIN_CONTENT
header, and supports different MIME types. The different MIME types are helpful for CLI and Jupyter usage. A user only needs to enable the feature flag an importuse prettytable::evcxr::*;
.I mage the feature off by default, because I was not sure, if the additional trait would be wanted by default. It is a small trait and implementation (as seen in
evcxr.rs
).Here is a Screenshot how it looks in Jupyter with Evcxr Rust kernel:
