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

Exporting console content to SVG #2101

Merged
merged 31 commits into from Mar 29, 2022
Merged

Exporting console content to SVG #2101

merged 31 commits into from Mar 29, 2022

Conversation

darrenburns
Copy link
Member

@darrenburns darrenburns commented Mar 24, 2022

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

Adds ability to export SVGs from Rich containing console contents.

scratch_7

@codecov-commenter
Copy link

codecov-commenter commented Mar 28, 2022

Codecov Report

Merging #2101 (8520041) into master (6dfb81d) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #2101      +/-   ##
==========================================
- Coverage   99.48%   99.47%   -0.01%     
==========================================
  Files          72       72              
  Lines        7334     7412      +78     
==========================================
+ Hits         7296     7373      +77     
- Misses         38       39       +1     
Flag Coverage Δ
unittests 99.47% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
rich/__main__.py 100.00% <ø> (ø)
rich/__init__.py 100.00% <100.00%> (ø)
rich/_lru_cache.py 100.00% <100.00%> (ø)
rich/console.py 99.21% <100.00%> (+0.06%) ⬆️
rich/repr.py 100.00% <100.00%> (ø)
rich/terminal_theme.py 100.00% <100.00%> (ø)
rich/traceback.py 99.55% <100.00%> (ø)
rich/segment.py 99.01% <0.00%> (-0.33%) ⬇️

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 e10bebf...8520041. Read the comment docs.

@darrenburns darrenburns marked this pull request as ready for review March 28, 2022 15:04
Copy link
Collaborator

@willmcgugan willmcgugan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic.

Could we move the styles from inline in to the <style> tag. You may be able to reuse the code from export_html.

rich/console.py Outdated Show resolved Hide resolved
rich/console.py Show resolved Hide resolved
docs/images/svg_export.svg Show resolved Hide resolved
Copy link
Collaborator

@willmcgugan willmcgugan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Would you mind updating the SVG in the docs to use the stylesheet.

Feel free to merge once that's done.

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

Successfully merging this pull request may close these issues.

None yet

3 participants