Skip to content

Add height option to stlite directive#38

Open
tkoyama010 wants to merge 2 commits intoatsphinx:mainfrom
tkoyama010:feature/add-height-option
Open

Add height option to stlite directive#38
tkoyama010 wants to merge 2 commits intoatsphinx:mainfrom
tkoyama010:feature/add-height-option

Conversation

@tkoyama010
Copy link

@tkoyama010 tkoyama010 commented Jan 31, 2026

Summary

Add :height: option to customize iframe height.

Usage

.. stlite::
   :height: 600px

   import streamlit as st
   st.title("Custom Height")

Supports CSS units (px, rem) and numeric values (auto-converted to px).

Changes

  • Add :height: option to directive
  • Apply inline style to iframe when height is specified
  • Add documentation and tests
  • Add example page

Backward compatible - default behavior unchanged.

Reference

tkoyama010/awesome-sphinx-revealjs#4

- Add :height: option to customize iframe height
- Support units (px, rem) and numeric values (auto-convert to px)
- Update documentation with usage examples
- Add test cases for height option parsing
- Add custom-height.rst example page
Copilot AI review requested due to automatic review settings January 31, 2026 08:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a :height: option to the stlite directive, allowing users to customize the iframe height using inline styles. This provides a cleaner alternative to the existing workaround of using raw HTML and CSS (as seen in plot-histogram-chart.rst).

Changes:

  • Added :height: directive option that accepts CSS units (px, rem) or numeric values (auto-converted to px)
  • Implemented inline style generation for iframe elements when height is specified
  • Added comprehensive documentation and example page

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/atsphinx/stlite/directives.py Adds :height: option to directive's option_spec and default options
src/atsphinx/stlite/nodes.py Implements inline style attribute generation for custom heights
tests/test_directives.py Adds parametrized tests for height option parsing (px, rem, numeric)
docs/guide.rst Documents the new :height: directive option with examples
docs/examples/custom-height.rst Provides practical examples demonstrating height customization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant