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

Html and Evcxr integration #101

merged 3 commits into from Aug 26, 2019

Html and Evcxr integration #101

merged 3 commits into from Aug 26, 2019


Copy link

@jonasbb jonasbb commented Jan 20, 2019

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., the EVCXR_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 import use 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

Here is a Screenshot how it looks in Jupyter with Evcxr Rust kernel:
prettytable in jupyter

Copy link

codecov bot commented Jan 20, 2019

Codecov Report

Merging #101 into master will increase coverage by 1.49%.
The diff coverage is 92.66%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/ 86.87% <100%> (+1.65%) ⬆️
src/ 88.01% <85.71%> (+2.42%) ⬆️
src/ 90.86% <87.5%> (-0.16%) ⬇️
src/ 94.64% <95.23%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e06ea7...1980557. Read the comment docs.

@phsym phsym self-requested a review January 21, 2019 13:30
@phsym phsym self-assigned this Jan 21, 2019
Copy link

@phsym phsym left a 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 ?

@phsym phsym assigned jonasbb and unassigned phsym Aug 25, 2019
@phsym phsym added this to the V0.9.0 milestone Aug 25, 2019
* 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.
Copy link
Contributor Author

jonasbb commented Aug 25, 2019

@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.

phsym approved these changes Aug 26, 2019
@phsym phsym merged commit bdfb150 into phsym:master Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants