Skip to content

Conversation

@MaddyGuthridge
Copy link
Member

@MaddyGuthridge MaddyGuthridge commented Feb 5, 2025

Resolves #88

  • Add definition for Options dataclass, which can be passed to tag constructors to control rendering.
  • Update tag code to accept Options objects and pass them to other classes during rendering.
  • Make use of Options during rendering to control how HTML is rendered.
  • Document how to use Options class to control rendering
  • Allow certain tags (especially <p>) to specify default options to apply, so that paragraphs don't have weird spacing without requiring any changes.

Important: this breaks compatibility with Python 3.9 due to using kw_only=True for the dataclass.

@github-actions
Copy link

github-actions bot commented Feb 5, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1446 1446 100% 0% 🟢

New Files

File Coverage Status
pyhtml/__render_options.py 100% 🟢
tests/render_options_test.py 100% 🟢
TOTAL 100% 🟢

Modified Files

File Coverage Status
pyhtml/init.py 100% 🟢
pyhtml/__tag_base.py 100% 🟢
pyhtml/__tags/init.py 100% 🟢
pyhtml/__tags/comment.py 100% 🟢
pyhtml/__tags/dangerous_raw_html.py 100% 🟢
pyhtml/__tags/generated.py 100% 🟢
pyhtml/__tags/input_tag.py 100% 🟢
pyhtml/__types.py 100% 🟢
pyhtml/__util.py 100% 🟢
tests/basic_rendering_test.py 100% 🟢
tests/end_to_end/flask_test.py 100% 🟢
tests/escape_test.py 100% 🟢
TOTAL 100% 🟢

updated for commit: 7004c26 by action🐍

@MaddyGuthridge MaddyGuthridge merged commit e8d3e8a into main Feb 12, 2025
6 checks passed
@MaddyGuthridge MaddyGuthridge deleted the maddy-render-options branch February 12, 2025 11:02
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.

Add a render options object that can specify rendering options for an element and its children

2 participants